Archived
1
0

chore: provide details when update.checked tests fail (#5115)

Using the toBe* functions will let us know what the actual values are
rather than just telling us true does not equal false.
This commit is contained in:
Asher 2022-04-19 15:46:23 -05:00 committed by GitHub
parent 7780a13cce
commit c35bf1311e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -145,7 +145,7 @@ describe("update", () => {
await expect(settings().read()).resolves.toEqual({ update })
expect(isNaN(update.checked)).toStrictEqual(false)
expect(update.checked < now).toBe(true)
expect(update.checked).toBeLessThan(now)
expect(update.version).toStrictEqual("2.1.0")
expect(spy).toEqual([])
})
@ -159,7 +159,8 @@ describe("update", () => {
await expect(settings().read()).resolves.toEqual({ update })
expect(isNaN(update.checked)).toStrictEqual(false)
expect(update.checked < Date.now() && update.checked >= now).toStrictEqual(true)
expect(update.checked).toBeGreaterThanOrEqual(now)
expect(update.checked).toBeLessThan(Date.now())
expect(update.version).toStrictEqual("4.1.1")
expect(spy).toStrictEqual(["/latest"])
})
@ -204,14 +205,16 @@ describe("update", () => {
let now = Date.now()
let update = await provider.getUpdate(true)
expect(isNaN(update.checked)).toStrictEqual(false)
expect(update.checked < Date.now() && update.checked >= now).toEqual(true)
expect(update.checked).toBeGreaterThanOrEqual(now)
expect(update.checked).toBeLessThan(Date.now())
expect(update.version).toStrictEqual("unknown")
provider = new UpdateProvider("http://probably.invalid.dev.localhost/latest", settings())
now = Date.now()
update = await provider.getUpdate(true)
expect(isNaN(update.checked)).toStrictEqual(false)
expect(update.checked < Date.now() && update.checked >= now).toEqual(true)
expect(update.checked).toBeGreaterThanOrEqual(now)
expect(update.checked).toBeLessThan(Date.now())
expect(update.version).toStrictEqual("unknown")
})