mirror of https://github.com/coder/code-server.git
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:
parent
7780a13cce
commit
c35bf1311e
|
@ -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")
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue