Skip to content

Commit 64c01fa

Browse files
authored
chore: replace bs-jest with rescript-jest
1 parent b968bbc commit 64c01fa

File tree

5 files changed

+2354
-3345
lines changed

5 files changed

+2354
-3345
lines changed

__tests__/CronJob_tests.res

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe("creating of CronJob", () => {
2626
RescriptJestDateMock.advanceTo(Js.Date.fromString(postFutureDate))
2727
Jest.runAllTimers()
2828

29-
expect(jobHasTicked.contents) |> toEqual(true)
29+
expect(jobHasTicked.contents) -> toEqual(true)
3030
})
3131

3232
test("creating a CronJob with onComplete option", () => {
@@ -43,7 +43,7 @@ describe("creating of CronJob", () => {
4343
RescriptCron.start(job)
4444
RescriptCron.stop(job)
4545

46-
expect(jobHasCompleted.contents) |> toEqual(true)
46+
expect(jobHasCompleted.contents) -> toEqual(true)
4747
})
4848

4949
test("creating a CronJob with onTick and onComplete as param", () => {
@@ -65,7 +65,7 @@ describe("creating of CronJob", () => {
6565
RescriptJestDateMock.advanceTo(Js.Date.fromString(postFutureDate))
6666
Jest.runAllTimers()
6767

68-
expect(jobHasTicked.contents && jobHasCompleted.contents) |> toEqual(true)
68+
expect(jobHasTicked.contents && jobHasCompleted.contents) -> toEqual(true)
6969
})
7070

7171
test("creating a CronJob and not starting will not trigger onTick", () => {
@@ -79,7 +79,7 @@ describe("creating of CronJob", () => {
7979
RescriptJestDateMock.advanceTo(Js.Date.fromString(postFutureDate))
8080
Jest.runAllTimers()
8181

82-
expect(jobHasTicked.contents) |> toEqual(false)
82+
expect(jobHasTicked.contents) -> toEqual(false)
8383
})
8484

8585
test("creating a CronJob with automatic start of the job", () => {
@@ -93,7 +93,7 @@ describe("creating of CronJob", () => {
9393
RescriptJestDateMock.advanceTo(Js.Date.fromString(postFutureDate))
9494
Jest.runAllTimers()
9595

96-
expect(jobHasTicked.contents) |> toEqual(true)
96+
expect(jobHasTicked.contents) -> toEqual(true)
9797
})
9898
})
9999

@@ -117,7 +117,7 @@ describe("changing CronJobs", () => {
117117
RescriptJestDateMock.advanceTo(Js.Date.fromString(postFutureDate))
118118
Jest.runAllTimers()
119119

120-
expect(jobHasTicked.contents && callbackHasTicked.contents) |> toEqual(true)
120+
expect(jobHasTicked.contents && callbackHasTicked.contents) -> toEqual(true)
121121
})
122122

123123
test("fire all callbacks for a CronJob (without timer expiring)", () => {
@@ -143,7 +143,7 @@ describe("changing CronJobs", () => {
143143

144144
expect(
145145
jobHasTicked.contents && (callbackHasTicked1.contents && callbackHasTicked2.contents),
146-
) |> toEqual(true)
146+
) -> toEqual(true)
147147
})
148148

149149
test("changing time of CronJob with setTime and a CronTime", () => {
@@ -165,6 +165,6 @@ describe("changing CronJobs", () => {
165165

166166
let nextTick = RescriptCron.nextMomentDates(job)->Array.get(0)
167167

168-
expect(MomentRe.Moment.toJSON(nextTick)) |> toEqual(MomentRe.Moment.toJSON(nextAssumedTick))
168+
expect(MomentRe.Moment.toJSON(nextTick)) -> toEqual(MomentRe.Moment.toJSON(nextAssumedTick))
169169
})
170170
})

__tests__/CronSyntax_tests.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe("functions for just dealing with crontab syntax", () => {
1616
// At minute 10
1717
let nextSchedule = RescriptCron.sendAt(#CronString("* 10 * * * *"))
1818

19-
expect(MomentRe.Moment.isSame(nextSchedule, aMomentTenMinutesLater)) |> toBe(true)
19+
expect(MomentRe.Moment.isSame(nextSchedule, aMomentTenMinutesLater)) -> toBe(true)
2020
})
2121

2222
test("sendAt with cron syntax at hour 10", () => {
@@ -28,7 +28,7 @@ describe("functions for just dealing with crontab syntax", () => {
2828

2929
let aMomentWithNext10Hour = MomentRe.momentWithDate(aDate) |> MomentRe.Moment.setHour(20)
3030

31-
expect(MomentRe.Moment.isSame(nextSchedule, aMomentWithNext10Hour)) |> toBe(true)
31+
expect(MomentRe.Moment.isSame(nextSchedule, aMomentWithNext10Hour)) -> toBe(true)
3232
})
3333

3434
test("sendAt with Js.date instead of cron syntax", () => {
@@ -40,7 +40,7 @@ describe("functions for just dealing with crontab syntax", () => {
4040
// Future Js.Date
4141
let nextSchedule = RescriptCron.sendAt(#JsDate(Js.Date.fromString(futureDate)))
4242

43-
expect(nextSchedule |> MomentRe.Moment.toDate |> Js.Date.toISOString) |> toBe(futureDate)
43+
expect(nextSchedule |> MomentRe.Moment.toDate |> Js.Date.toISOString) -> toBe(futureDate)
4444
})
4545

4646
test("timeout", () => {
@@ -54,6 +54,6 @@ describe("functions for just dealing with crontab syntax", () => {
5454

5555
let msDiff = MomentRe.diff(aMomentWithNext10Hour, MomentRe.momentNow(), #milliseconds)
5656

57-
expect(msToNextFire) |> toEqual(msDiff)
57+
expect(msToNextFire) -> toEqual(msDiff)
5858
})
5959
})

bsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"suffix": ".bs.js",
1919
"bs-dependencies": ["bs-moment"],
20-
"bs-dev-dependencies": ["@glennsl/bs-jest", "rescript-jest-date-mock"],
20+
"bs-dev-dependencies": ["@glennsl/rescript-jest", "rescript-jest-date-mock"],
2121
"warnings": {
2222
"error": "+101"
2323
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"bugs": "https://github.com/mikaello/rescript-node-cron/issues",
2222
"license": "MIT",
2323
"devDependencies": {
24-
"@glennsl/bs-jest": "0.7.0",
24+
"@glennsl/rescript-jest": "0.9.1",
2525
"@ristostevcev/bs-odoc": "1.3.0",
2626
"rescript": "9.1.4",
2727
"rescript-jest-date-mock": "2.0.0"

0 commit comments

Comments
 (0)