Clarify and strengthen state invariant tests
This commit is contained in:
@@ -90,7 +90,7 @@ test('state v1 normalizes legacy storage and validates the canonical snapshot',
|
||||
);
|
||||
});
|
||||
|
||||
test('GET and domain mutations return one state shape with monotonic revisions', async (t) => {
|
||||
test('data invariant: API mutations return one snapshot, increase revision and roll back subscription failures', async (t) => {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'harbor-state-contract-'));
|
||||
const binDir = path.join(dir, 'bin');
|
||||
const config = {
|
||||
|
||||
@@ -17,7 +17,7 @@ const fixture = (t) => {
|
||||
return path.join(directory, 'state.json');
|
||||
};
|
||||
|
||||
test('a failure before rename preserves the last successful file', (t) => {
|
||||
test('data invariant: failure before rename preserves the last successful file', (t) => {
|
||||
const filePath = fixture(t);
|
||||
atomicWriteJson(filePath, { revision: 1 });
|
||||
|
||||
@@ -79,7 +79,7 @@ test('ambiguous legacy selectedTag explicitly requires a new choice', (t) => {
|
||||
assert.equal(migrated.servers.length, 2);
|
||||
});
|
||||
|
||||
test('corrupt JSON is preserved and replaced with an explicit recovery state', (t) => {
|
||||
test('data invariant: corrupt JSON preserves original bytes and returns explicit recovery state', (t) => {
|
||||
const filePath = fixture(t);
|
||||
fs.writeFileSync(filePath, '{broken');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user