Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,37 @@ import yarn, {
getNPMMetadataForDep,
} from "./index"

const RealDate = Date
const FIXED_NOW = "2022-04-21T00:00:00.000Z"

declare const global: any
beforeEach(() => {
global.warn = jest.fn()
global.message = jest.fn()
global.fail = jest.fn()
global.markdown = jest.fn()
global.danger = { utils: { sentence: jest.fn() } }
global.Date = class extends RealDate {
static now() {
return new RealDate(FIXED_NOW).getTime()
}

constructor(value?: any) {
if (arguments.length) {
super(value)
} else {
super(FIXED_NOW)
}
}
}
})

afterEach(() => {
global.warn = undefined
global.message = undefined
global.fail = undefined
global.markdown = undefined
global.Date = RealDate
})

describe("checkForRelease", () => {
Expand Down