Added chained "pipe" function formatting tests (#6818)
Co-authored-by: Simon Lydell <simon.lydell@gmail.com> Co-authored-by: Christopher J. Brody <chris@brody.consulting> Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
3 files changed
+272
No files matched your search
@@ -258,6 +258,188 @@ MongoClient.connect("mongodb://localhost:27017/posts", (err, db) => {
|
|||||||
================================================================================
|
================================================================================
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`pipe-function-calls.js format 1`] = `
|
||||||
|
====================================options=====================================
|
||||||
|
parsers: ["babel", "flow", "typescript"]
|
||||||
|
printWidth: 80
|
||||||
|
| printWidth
|
||||||
|
=====================================input======================================
|
||||||
|
(() => {
|
||||||
|
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=====================================
|
||||||
|
(() => {
|
||||||
|
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[`pipe-function-calls-with-comments.js format 1`] = `
|
||||||
|
====================================options=====================================
|
||||||
|
parsers: ["babel", "flow", "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 format 1`] = `
|
exports[`ramda_compose.js format 1`] = `
|
||||||
====================================options=====================================
|
====================================options=====================================
|
||||||
parsers: ["babel", "flow", "typescript"]
|
parsers: ["babel", "flow", "typescript"]
|
||||||
|
|||||||
@@ -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,0 +1,41 @@
|
|||||||
|
(() => {
|
||||||
|
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
|
||||||
|
)
|
||||||
|
);
|
||||||
|
})();
|
||||||
Reference in new issue
Block a user