Skip to content

Commit

Permalink
mock -> stub
Browse files Browse the repository at this point in the history
  • Loading branch information
josefarias committed Jan 8, 2025
1 parent c4cefca commit e907919
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions test/javascripts/src/relative_date_test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import LocalTime from "local_time"

const { addTimeEl, assert, defer, getText, testAsync, testGroup, mockNow } = LocalTime.TestHelpers
const { addTimeEl, assert, defer, getText, testAsync, testGroup, stubNow } = LocalTime.TestHelpers

testGroup("relative date", () => {
testAsync("this year", (done) => {
Expand Down Expand Up @@ -109,7 +109,7 @@ testGroup("relative weekday or date", () => {
})

testAsync("before this week", (done) => {
mockNow(`${moment().year()}-03-20`, () => {
stubNow(`${moment().year()}-03-20`, () => {
const before = moment().subtract("days", 8)
const el = addTimeEl({ type: "weekday-or-date", datetime: before.toISOString() })
defer(() => {
Expand Down
2 changes: 1 addition & 1 deletion test/javascripts/src/test_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ LocalTime.TestHelpers = {
setTimeout(callback, 1)
},

mockNow(dateString, callback) {
stubNow(dateString, callback) {
const originalNow = moment.now
try {
moment.now = () => new Date(dateString).getTime()
Expand Down

0 comments on commit e907919

Please sign in to comment.