mirror of
https://github.com/stablyai/orca.git
synced 2026-10-25 16:03:53 +00:00
* oom(01): A1-shared-readers — reintroduce #10179 subset Files: 18 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> * oom(02): A2-shared-image-media — reintroduce #10179 subset Files: 7 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> * oom(03): A3-shared-fs-listing — reintroduce #10179 subset Files: 21 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> * oom(04): A4-shared-remote-relay — reintroduce #10179 subset Files: 8 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> * oom(05): A5-shared-misc — reintroduce #10179 subset Files: 28 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> * oom(06): B-shared-wiring — reintroduce #10179 subset Files: 81 applied, 0 deleted (from6eb70d8370) Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
assertMobileFileDirectoryWithinLimit,
|
|
MOBILE_FILE_DIRECTORY_LIMIT_MESSAGE,
|
|
MOBILE_FILE_DIRECTORY_MAX_ENTRIES,
|
|
MOBILE_FILE_DIRECTORY_MAX_RETAINED_BYTES
|
|
} from './mobile-file-directory-limit'
|
|
|
|
describe('mobile file directory limit', () => {
|
|
it('accepts a complete directory listing within both limits', () => {
|
|
expect(() =>
|
|
assertMobileFileDirectoryWithinLimit([
|
|
{ name: 'src' },
|
|
{ name: 'README.md' },
|
|
{ name: 'package.json' }
|
|
])
|
|
).not.toThrow()
|
|
})
|
|
|
|
it('rejects rather than truncating an excessive entry count', () => {
|
|
const entries = Array.from({ length: MOBILE_FILE_DIRECTORY_MAX_ENTRIES + 1 }, () => ({
|
|
name: 'x'
|
|
}))
|
|
|
|
expect(() => assertMobileFileDirectoryWithinLimit(entries)).toThrow(
|
|
MOBILE_FILE_DIRECTORY_LIMIT_MESSAGE
|
|
)
|
|
})
|
|
|
|
it('rejects a listing whose names exceed the retained-byte limit', () => {
|
|
const name = 'x'.repeat(MOBILE_FILE_DIRECTORY_MAX_RETAINED_BYTES / 2)
|
|
|
|
expect(() => assertMobileFileDirectoryWithinLimit([{ name }])).toThrow(
|
|
MOBILE_FILE_DIRECTORY_LIMIT_MESSAGE
|
|
)
|
|
})
|
|
})
|