writeFileAtomic: exclusive-create random-suffix temp + rename carrying the caller-stated mode; settings-local persistSection now consumes it. The credentials-local store shares it next.
19 lines
642 B
TypeScript
19 lines
642 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { Context } from 'cordis'
|
|
import InvariantService from '@deepseek-ai/dsh-invariants'
|
|
import * as AtomicWriteInvariant from '../src/invariant.ts'
|
|
|
|
describe('atomic-write invariant companion', () => {
|
|
it('registers its explained empty runtime invariant', async () => {
|
|
const ctx = new Context()
|
|
await ctx.plugin(InvariantService)
|
|
const fiber = await ctx.plugin(AtomicWriteInvariant)
|
|
|
|
expect(() => {
|
|
ctx.invariants.register('@deepseek-ai/dsh-atomic-write', () => {})
|
|
}).toThrow(/already registered/)
|
|
await fiber.dispose()
|
|
await ctx.fiber.dispose()
|
|
})
|
|
})
|