This commit is contained in:
parent
921d7b63eb
commit
a1cce7bfcd
@ -1,7 +1,13 @@
|
|||||||
|
import { readFile } from 'node:fs/promises'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
describe('sync contract', () => {
|
describe('sync contract', () => {
|
||||||
it('keeps capture independent from browser connectivity state', () => {
|
it('does not treat browser connectivity state as proof that the API is reachable', async () => {
|
||||||
expect(typeof navigator === 'undefined' || typeof navigator.onLine === 'boolean').toBe(true)
|
const source = await readFile(fileURLToPath(new URL('./sync.ts', import.meta.url)), 'utf8')
|
||||||
|
|
||||||
|
expect(source).not.toContain('navigator.onLine')
|
||||||
|
expect(source).toContain("window.addEventListener('online'")
|
||||||
|
expect(source).toContain("document.addEventListener('visibilitychange'")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user