chore: scaffold tracks and tooling
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6dc5bdde9e
commit
e150b7fefb
@@ -0,0 +1,18 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { dirname, join } from 'node:path'
|
||||
|
||||
const here = dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
/** Load fixtures/<name>.json as { function, cases: [{ name, args, expected }] }. */
|
||||
export const loadFixture = (name) =>
|
||||
JSON.parse(readFileSync(join(here, '..', '..', 'fixtures', `${name}.json`), 'utf8'))
|
||||
|
||||
/** Deep-freeze for tests (independent of the student's deepFreeze). */
|
||||
export const freeze = (x) => {
|
||||
if (x !== null && typeof x === 'object' && !Object.isFrozen(x)) {
|
||||
Object.freeze(x)
|
||||
Object.values(x).forEach(freeze)
|
||||
}
|
||||
return x
|
||||
}
|
||||
Reference in New Issue
Block a user