Skip to content

Commit

Permalink
add pipeline function call test
Browse files Browse the repository at this point in the history
which was correct according to prettier@1.18.2

Co-authored-by: Simon Lydell <simon.lydell@gmail.com>
Co-authored-by: Christopher J. Brody <chris@brody.consulting>
  • Loading branch information
Christopher J. Brody and lydell committed Nov 6, 2019
1 parent c26f087 commit 4fb705b
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
76 changes: 76 additions & 0 deletions tests/functional_composition/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,82 @@ MongoClient.connect("mongodb://localhost:27017/posts", (err, db) => {
================================================================================
`;

exports[`pipe-function-calls.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
// input is formatted correctly according to prettier@1.18.2
(() => {
pipe(
timelines,
everyCommitTimestamps,
A.sort(ordDate),
A.head
);
pipe(
serviceEventFromMessage(msg),
TE.chain(
flow(
publishServiceEvent(analytics),
TE.mapLeft(nackFromError)
)
)
)()
.then(messageResponse(logger, msg))
.catch((err: Error) => {
logger.error(
pipe(
O.fromNullable(err.stack),
O.getOrElse(constant(err.message))
)
);
process.exit(1);
});
pipe(
Changelog.timestampOfFirstCommit([[commit]]),
O.toUndefined
);
chain(
flow(
getUploadUrl,
E.mapLeft(Errors.unknownError),
TE.fromEither
)
);
})();
=====================================output=====================================
// input is formatted correctly according to prettier@1.18.2
(() => {
pipe(timelines, everyCommitTimestamps, A.sort(ordDate), A.head);
pipe(
serviceEventFromMessage(msg),
TE.chain(flow(publishServiceEvent(analytics), TE.mapLeft(nackFromError)))
)()
.then(messageResponse(logger, msg))
.catch((err: Error) => {
logger.error(
pipe(O.fromNullable(err.stack), O.getOrElse(constant(err.message)))
);
process.exit(1);
});
pipe(Changelog.timestampOfFirstCommit([[commit]]), O.toUndefined);
chain(flow(getUploadUrl, E.mapLeft(Errors.unknownError), TE.fromEither));
})();
================================================================================
`;

exports[`ramda_compose.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
Expand Down
43 changes: 43 additions & 0 deletions tests/functional_composition/pipe-function-calls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// input is formatted correctly according to prettier@1.18.2

(() => {
pipe(
timelines,
everyCommitTimestamps,
A.sort(ordDate),
A.head
);

pipe(
serviceEventFromMessage(msg),
TE.chain(
flow(
publishServiceEvent(analytics),
TE.mapLeft(nackFromError)
)
)
)()
.then(messageResponse(logger, msg))
.catch((err: Error) => {
logger.error(
pipe(
O.fromNullable(err.stack),
O.getOrElse(constant(err.message))
)
);
process.exit(1);
});

pipe(
Changelog.timestampOfFirstCommit([[commit]]),
O.toUndefined
);

chain(
flow(
getUploadUrl,
E.mapLeft(Errors.unknownError),
TE.fromEither
)
);
})();

0 comments on commit 4fb705b

Please sign in to comment.