// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`functional_compose.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
compose(
  sortBy(x => x),
  flatten,
  map(x => [x, x*2])
);

somelib.compose(
  sortBy(x => x),
  flatten,
  map(x => [x, x*2])
);

composeFlipped(
  sortBy(x => x),
  flatten,
  map(x => [x, x*2])
);

somelib.composeFlipped(
  sortBy(x => x),
  flatten,
  map(x => [x, x*2])
);

// no regression (#4602)
const hasValue = hasOwnProperty(a, b);

this.compose(sortBy(x => x), flatten);
this.a.b.c.compose(sortBy(x => x), flatten);
someObj.someMethod(this.field.compose(a, b));

class A extends B {
  compose() {
    super.compose(sortBy(x => x), flatten);
  }
}

this.subscriptions.add(
            this.componentUpdates
                .pipe(startWith(this.props), distinctUntilChanged(isEqual))
                .subscribe(props => {

                })
        )

=====================================output=====================================
compose(
  sortBy(x => x),
  flatten,
  map(x => [x, x * 2])
);

somelib.compose(
  sortBy(x => x),
  flatten,
  map(x => [x, x * 2])
);

composeFlipped(
  sortBy(x => x),
  flatten,
  map(x => [x, x * 2])
);

somelib.composeFlipped(
  sortBy(x => x),
  flatten,
  map(x => [x, x * 2])
);

// no regression (#4602)
const hasValue = hasOwnProperty(a, b);

this.compose(
  sortBy(x => x),
  flatten
);
this.a.b.c.compose(
  sortBy(x => x),
  flatten
);
someObj.someMethod(
  this.field.compose(
    a,
    b
  )
);

class A extends B {
  compose() {
    super.compose(
      sortBy(x => x),
      flatten
    );
  }
}

this.subscriptions.add(
  this.componentUpdates
    .pipe(
      startWith(this.props),
      distinctUntilChanged(isEqual)
    )
    .subscribe(props => {})
);

================================================================================
`;

exports[`gobject_connect.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
button.connect(
  "clicked",
  () => doSomething()
);
app.connect(
  "activate",
  async () => {
    await data.load();
    win.show_all();
  }
);

=====================================output=====================================
button.connect("clicked", () => doSomething());
app.connect("activate", async () => {
  await data.load();
  win.show_all();
});

================================================================================
`;

exports[`lodash_flow.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
import { flow } from "lodash";

const foo = flow(
  x => x + 1,
  x => x * 3,
  x => x - 6,
);

foo(6);

import * as _ from "lodash";

const foo = _.flow(
  x => x + 1,
  x => x * 3,
  x => x - 6,
);

foo(6);

=====================================output=====================================
import { flow } from "lodash";

const foo = flow(
  x => x + 1,
  x => x * 3,
  x => x - 6
);

foo(6);

import * as _ from "lodash";

const foo = _.flow(
  x => x + 1,
  x => x * 3,
  x => x - 6
);

foo(6);

================================================================================
`;

exports[`lodash_flow_right.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
import { flowRight } from "lodash";

const foo = flowRight(
  x => x + 1,
  x => x * 3,
  x => x - 6,
);

foo(6);

import * as _ from "lodash";

const foo = _.flowRight(
  x => x + 1,
  x => x * 3,
  x => x - 6,
);

foo(6);

=====================================output=====================================
import { flowRight } from "lodash";

const foo = flowRight(
  x => x + 1,
  x => x * 3,
  x => x - 6
);

foo(6);

import * as _ from "lodash";

const foo = _.flowRight(
  x => x + 1,
  x => x * 3,
  x => x - 6
);

foo(6);

================================================================================
`;

exports[`mongo_connect.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
MongoClient.connect(
  "mongodb://localhost:27017/posts",
  (err, db) => {
    assert.equal(null, err);
    db.close();
  }
);

=====================================output=====================================
MongoClient.connect("mongodb://localhost:27017/posts", (err, db) => {
  assert.equal(null, err);
  db.close();
});

================================================================================
`;

exports[`ramda_compose.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
var classyGreeting = (firstName, lastName) =>
  "The name's " + lastName + ", " + firstName + " " + lastName;
var yellGreeting = R.compose(R.toUpper, classyGreeting);
yellGreeting("James", "Bond"); //=> "THE NAME'S BOND, JAMES BOND"

R.compose(Math.abs, R.add(1), R.multiply(2))(-4); //=> 7

//  get :: String -> Object -> Maybe *
var get = R.curry((propName, obj) => Maybe(obj[propName]));

//  getStateCode :: Maybe String -> Maybe String
var getStateCode = R.composeK(
  R.compose(Maybe.of, R.toUpper),
  get("state"),
  get("address"),
  get("user")
);
getStateCode({ user: { address: { state: "ny" } } }); //=> Maybe.Just("NY")
getStateCode({}); //=> Maybe.Nothing()

var db = {
  users: {
    JOE: {
      name: "Joe",
      followers: ["STEVE", "SUZY"]
    }
  }
};

// We'll pretend to do a db lookup which returns a promise
var lookupUser = userId => Promise.resolve(db.users[userId]);
var lookupFollowers = user => Promise.resolve(user.followers);
lookupUser("JOE").then(lookupFollowers);

//  followersForUser :: String -> Promise [UserId]
var followersForUser = R.composeP(lookupFollowers, lookupUser);
followersForUser("JOE").then(followers => console.log("Followers:", followers));
// Followers: ["STEVE","SUZY"]

=====================================output=====================================
var classyGreeting = (firstName, lastName) =>
  "The name's " + lastName + ", " + firstName + " " + lastName;
var yellGreeting = R.compose(
  R.toUpper,
  classyGreeting
);
yellGreeting("James", "Bond"); //=> "THE NAME'S BOND, JAMES BOND"

R.compose(
  Math.abs,
  R.add(1),
  R.multiply(2)
)(-4); //=> 7

//  get :: String -> Object -> Maybe *
var get = R.curry((propName, obj) => Maybe(obj[propName]));

//  getStateCode :: Maybe String -> Maybe String
var getStateCode = R.composeK(
  R.compose(
    Maybe.of,
    R.toUpper
  ),
  get("state"),
  get("address"),
  get("user")
);
getStateCode({ user: { address: { state: "ny" } } }); //=> Maybe.Just("NY")
getStateCode({}); //=> Maybe.Nothing()

var db = {
  users: {
    JOE: {
      name: "Joe",
      followers: ["STEVE", "SUZY"]
    }
  }
};

// We'll pretend to do a db lookup which returns a promise
var lookupUser = userId => Promise.resolve(db.users[userId]);
var lookupFollowers = user => Promise.resolve(user.followers);
lookupUser("JOE").then(lookupFollowers);

//  followersForUser :: String -> Promise [UserId]
var followersForUser = R.composeP(
  lookupFollowers,
  lookupUser
);
followersForUser("JOE").then(followers => console.log("Followers:", followers));
// Followers: ["STEVE","SUZY"]

================================================================================
`;

exports[`ramda_pipe.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
var f = R.pipe(Math.pow, R.negate, R.inc);

f(3, 4); // -(3^4) + 1

//  parseJson :: String -> Maybe *
//  get :: String -> Object -> Maybe *

//  getStateCode :: Maybe String -> Maybe String
var getStateCode = R.pipeK(
  parseJson,
  get("user"),
  get("address"),
  get("state"),
  R.compose(Maybe.of, R.toUpper)
);

getStateCode('{"user":{"address":{"state":"ny"}}}');
//=> Just('NY')
getStateCode("[Invalid JSON]");
//=> Nothing()

//  followersForUser :: String -> Promise [User]
var followersForUser = R.pipeP(db.getUserById, db.getFollowers);

=====================================output=====================================
var f = R.pipe(
  Math.pow,
  R.negate,
  R.inc
);

f(3, 4); // -(3^4) + 1

//  parseJson :: String -> Maybe *
//  get :: String -> Object -> Maybe *

//  getStateCode :: Maybe String -> Maybe String
var getStateCode = R.pipeK(
  parseJson,
  get("user"),
  get("address"),
  get("state"),
  R.compose(
    Maybe.of,
    R.toUpper
  )
);

getStateCode('{"user":{"address":{"state":"ny"}}}');
//=> Just('NY')
getStateCode("[Invalid JSON]");
//=> Nothing()

//  followersForUser :: String -> Promise [User]
var followersForUser = R.pipeP(
  db.getUserById,
  db.getFollowers
);

================================================================================
`;

exports[`redux_compose.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import DevTools from './containers/DevTools';
import reducer from '../reducers';

const store = createStore(
  reducer,
  compose(
    applyMiddleware(thunk),
    DevTools.instrument()
  )
)


=====================================output=====================================
import { createStore, applyMiddleware, compose } from "redux";
import thunk from "redux-thunk";
import DevTools from "./containers/DevTools";
import reducer from "../reducers";

const store = createStore(
  reducer,
  compose(
    applyMiddleware(thunk),
    DevTools.instrument()
  )
);

================================================================================
`;

exports[`redux_connect.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
const ArtistInput = connect(mapStateToProps, mapDispatchToProps, mergeProps)(Component);

=====================================output=====================================
const ArtistInput = connect(
  mapStateToProps,
  mapDispatchToProps,
  mergeProps
)(Component);

================================================================================
`;

exports[`reselect_createselector.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
import { createSelector } from 'reselect';

const resolve = createSelector(
  getIds,
  getObjects,
  (ids, objects) => ids.map(id => objects[id])
);

const resolve = createSelector(
  [getIds, getObjects],
  (ids, objects) => ids.map(id => objects[id])
);

=====================================output=====================================
import { createSelector } from "reselect";

const resolve = createSelector(
  getIds,
  getObjects,
  (ids, objects) => ids.map(id => objects[id])
);

const resolve = createSelector(
  [getIds, getObjects],
  (ids, objects) => ids.map(id => objects[id])
);

================================================================================
`;

exports[`rxjs_pipe.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
                                                                                | printWidth
=====================================input======================================
import { range } from 'rxjs/observable/range';
import { map, filter, scan } from 'rxjs/operators';

const source$ = range(0, 10);

source$.pipe(
  filter(x => x % 2 === 0),
  map(x => x + x),
  scan((acc, x) => acc + x, 0)
)
.subscribe(x => console.log(x))

=====================================output=====================================
import { range } from "rxjs/observable/range";
import { map, filter, scan } from "rxjs/operators";

const source$ = range(0, 10);

source$
  .pipe(
    filter(x => x % 2 === 0),
    map(x => x + x),
    scan((acc, x) => acc + x, 0)
  )
  .subscribe(x => console.log(x));

================================================================================
`;
