14 lines
565 B
TypeScript
14 lines
565 B
TypeScript
import { readFile } from 'node:fs/promises'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
describe('sync contract', () => {
|
|
it('does not treat browser connectivity state as proof that the API is reachable', async () => {
|
|
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'")
|
|
})
|
|
})
|