GooDrive/frontend/tests/transfers-live.test.js
Louis Mazin ac44c6ed8b nice
2026-10-13 23:47:19 +02:00

41 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
const src = path => readFileSync(new URL(`../src/${path}`, import.meta.url), 'utf8')
test('chaque import passe par le protocole fractionné avec progression en octets', () => {
const manager = src('hooks/useUploadQueue.js')
const api = src('api/client.js')
assert.match(manager, /onUploadProgress: event/)
assert.match(manager, /Math\.min\(part\.size, event\.loaded/)
assert.match(manager, /drive\.startUpload\(/)
assert.match(manager, /drive\.uploadStatus\(/)
assert.match(manager, /drive\.uploadChunk\(/)
assert.match(manager, /drive\.finishUpload\(/)
assert.match(manager, /drive\.cancelUpload\(/)
assert.match(manager, /requestRef\.current\?\.abort\(\)/)
assert.match(api, /cancelUpload:id=>api\.delete/)
})
test('un rafraichissement affiche un avertissement tant qu’un import reste en cours', () => {
const manager = src('hooks/useUploadQueue.js')
assert.match(manager, /addEventListener\('beforeunload'/)
assert.match(manager, /event\.preventDefault\(\)/)
assert.match(manager, /event\.returnValue = ''/)
})
test('les dossiers partagés sont actualisés silencieusement sans rechargement', () => {
const controller = src('hooks/useDriveController.js')
assert.match(controller, /setInterval\(poll, 4000\)/)
assert.match(controller, /document\.visibilityState/)
assert.match(controller, /refresh\(true\)/)
assert.match(controller, /requestSequence\.current/)
})
test('les longs titres et les boutons du menu ne débordent plus', () => {
const dialog = src('components/drive/dialogs/ItemActionsDialog.jsx')
assert.match(dialog, /break-all/)
assert.match(dialog, /grid-cols-1/)
assert.match(dialog, /min-w-0/)
})