import { test } from '@japa/runner' import { DiskSpace } from '#services/disk_space' test.group('DiskSpace', () => { test('short below the floor, fine again a margin above it; off without a floor', async ({ assert }) => { let gb = 15 const space = new DiskSpace('probing', '/', 12, async () => gb * 1e9, 0) assert.isFalse(await space.short()) gb = 11.5 assert.isTrue(await space.short()) // Back over the floor, not yet over the margin: still short. gb = 12.5 assert.isTrue(await space.short()) gb = 13.1 assert.isFalse(await space.short()) assert.isFalse(await new DiskSpace('probing', '/', 0, async () => 0, 0).short()) }) test('measures a real filesystem', async ({ assert }) => { assert.isFalse(await new DiskSpace('probing', '/', 0.001).short()) }) })