mirror of
https://github.com/stablyai/orca.git
synced 2026-11-03 02:27:43 +00:00
test: remove workflow string checks and strengthen provider assertions (#33017)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -8,27 +8,32 @@ it('re-derives SQLite assignments from malformed disposable cache data', async (
|
||||
.update(readFileSync(new URL('./vitest-sqlite-runtime-scan.mjs', import.meta.url)))
|
||||
.digest('hex')
|
||||
for (const files of [null, { 'fixture.test.ts': [1, 2, 'false'] }]) {
|
||||
vi.doMock('node:fs', async (original) => ({
|
||||
...(await original<typeof FileSystem>()),
|
||||
globSync: () => ['fixture.test.ts'],
|
||||
statSync: () => ({ mtimeMs: 1, size: 2 }),
|
||||
readFileSync: (path: Parameters<typeof readFileSync>[0]) =>
|
||||
String(path).endsWith('.json')
|
||||
? JSON.stringify({ version, files })
|
||||
: String(path).endsWith('fixture.test.ts')
|
||||
? 'export {}'
|
||||
: readFileSync(path),
|
||||
mkdirSync: vi.fn(),
|
||||
writeFileSync: vi.fn(),
|
||||
renameSync: vi.fn()
|
||||
}))
|
||||
vi.resetModules()
|
||||
try {
|
||||
const { findSqliteRuntimeTests } = await import('./vitest-sqlite-runtime-scan.mjs')
|
||||
expect(findSqliteRuntimeTests()).toEqual([])
|
||||
} finally {
|
||||
vi.doUnmock('node:fs')
|
||||
for (const [source, expected] of [
|
||||
['export {}', []],
|
||||
["import './src/main/sqlite/sync-database'", ['fixture.test.ts']]
|
||||
] as const) {
|
||||
vi.doMock('node:fs', async (original) => ({
|
||||
...(await original<typeof FileSystem>()),
|
||||
globSync: () => ['fixture.test.ts'],
|
||||
statSync: () => ({ mtimeMs: 1, size: 2 }),
|
||||
readFileSync: (path: Parameters<typeof readFileSync>[0]) =>
|
||||
String(path).endsWith('.json')
|
||||
? JSON.stringify({ version, files })
|
||||
: String(path).endsWith('fixture.test.ts')
|
||||
? source
|
||||
: readFileSync(path),
|
||||
mkdirSync: vi.fn(),
|
||||
writeFileSync: vi.fn(),
|
||||
renameSync: vi.fn()
|
||||
}))
|
||||
vi.resetModules()
|
||||
try {
|
||||
const { findSqliteRuntimeTests } = await import('./vitest-sqlite-runtime-scan.mjs')
|
||||
expect(findSqliteRuntimeTests()).toEqual(expected)
|
||||
} finally {
|
||||
vi.doUnmock('node:fs')
|
||||
vi.resetModules()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user