-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
1 parent
d697f37
commit 7659a86
Showing
3 changed files
with
272 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
tests/js/functional-composition/pipe-function-calls-with-comments.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) | ||
); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) | ||
); | ||
})(); |