Skip to content

Commit

Permalink
add another pipe function call test with added comments
Browse files Browse the repository at this point in the history
in order to avoid unwanted reformatting

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 4fb705b commit cb4494d
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 0 deletions.
110 changes: 110 additions & 0 deletions tests/functional_composition/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -334,6 +334,116 @@ printWidth: 80
================================================================================
`;

exports[`pipe-function-calls-with-comments.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
// input with some comments added to avoid reformatting
(() => {
pipe(
// add a descriptive comment here
timelines,
everyCommitTimestamps,
A.sort(ordDate),
A.head
);
pipe(
// add a descriptive comment here
serviceEventFromMessage(msg),
TE.chain(
flow(
// add a descriptive comment here
publishServiceEvent(analytics),
TE.mapLeft(nackFromError)
)
)
)()
.then(messageResponse(logger, msg))
.catch((err: Error) => {
logger.error(
pipe(
// add a descriptive comment here
O.fromNullable(err.stack),
O.getOrElse(constant(err.message))
)
);
process.exit(1);
});
pipe(
// add a descriptive comment here
Changelog.timestampOfFirstCommit([[commit]]),
O.toUndefined
);
chain(
flow(
// add a descriptive comment here
getUploadUrl,
E.mapLeft(Errors.unknownError),
TE.fromEither
)
);
})();
=====================================output=====================================
// input with some comments added to avoid reformatting
(() => {
pipe(
// add a descriptive comment here
timelines,
everyCommitTimestamps,
A.sort(ordDate),
A.head
);
pipe(
// add a descriptive comment here
serviceEventFromMessage(msg),
TE.chain(
flow(
// add a descriptive comment here
publishServiceEvent(analytics),
TE.mapLeft(nackFromError)
)
)
)()
.then(messageResponse(logger, msg))
.catch((err: Error) => {
logger.error(
pipe(
// add a descriptive comment here
O.fromNullable(err.stack),
O.getOrElse(constant(err.message))
)
);
process.exit(1);
});
pipe(
// add a descriptive comment here
Changelog.timestampOfFirstCommit([[commit]]),
O.toUndefined
);
chain(
flow(
// add a descriptive comment here
getUploadUrl,
E.mapLeft(Errors.unknownError),
TE.fromEither
)
);
})();
================================================================================
`;

exports[`ramda_compose.js 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "typescript"]
Expand Down
49 changes: 49 additions & 0 deletions tests/functional_composition/pipe-function-calls-with-comments.js
@@ -0,0 +1,49 @@
// input with some comments added to avoid reformatting

(() => {
pipe(
// add a descriptive comment here
timelines,
everyCommitTimestamps,
A.sort(ordDate),
A.head
);

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

pipe(
// add a descriptive comment here
Changelog.timestampOfFirstCommit([[commit]]),
O.toUndefined
);

chain(
flow(
// add a descriptive comment here
getUploadUrl,
E.mapLeft(Errors.unknownError),
TE.fromEither
)
);
})();

0 comments on commit cb4494d

Please sign in to comment.