From 4fb705b4ef859905e848d51cc08f030c2fb7ed06 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Tue, 5 Nov 2019 19:42:14 -0500 Subject: [PATCH] add pipeline function call test which was correct according to prettier@1.18.2 Co-authored-by: Simon Lydell Co-authored-by: Christopher J. Brody --- .../__snapshots__/jsfmt.spec.js.snap | 76 +++++++++++++++++++ .../pipe-function-calls.js | 43 +++++++++++ 2 files changed, 119 insertions(+) create mode 100644 tests/functional_composition/pipe-function-calls.js diff --git a/tests/functional_composition/__snapshots__/jsfmt.spec.js.snap b/tests/functional_composition/__snapshots__/jsfmt.spec.js.snap index 0f11bef6b8e7..ae233e9caf45 100644 --- a/tests/functional_composition/__snapshots__/jsfmt.spec.js.snap +++ b/tests/functional_composition/__snapshots__/jsfmt.spec.js.snap @@ -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"] diff --git a/tests/functional_composition/pipe-function-calls.js b/tests/functional_composition/pipe-function-calls.js new file mode 100644 index 000000000000..729439fe0892 --- /dev/null +++ b/tests/functional_composition/pipe-function-calls.js @@ -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 + ) + ); +})();