Services: delete dead RelationshipService; rename persistence to snippet-persistence

This commit is contained in:
2026-06-12 19:46:14 +03:00
parent 538882b342
commit 9a8b44380d
12 changed files with 86 additions and 209 deletions
+32
View File
@@ -52,6 +52,38 @@ describe('save — create', () => {
});
});
describe('save — rename propagation (docs/architecture/07 §6)', () => {
test('renaming via the edit form rewrites every referencing snippet', () => {
store().startCreate();
store().updateForm({ name: 'Sales', input: '[{"a":1}]' });
expect(store().save(T)).toBe(true);
// A published snippet referencing the dataset by name.
useSnippetStore.getState().hydrate(
[
createSnippet({
id: 'a',
spec: JSON.stringify({ data: { name: 'Sales' }, mark: 'bar' }),
now: T,
}),
],
'a',
);
useSnippetStore.getState().publish(T);
expect(useSnippetStore.getState().snippets[0].datasetRefs).toEqual(['Sales']);
store().startEdit();
store().updateForm({ name: 'Revenue' });
expect(store().save(new Date('2026-07-01T00:00:00Z'))).toBe(true);
expect(store().datasets[0].name).toBe('Revenue');
const s = useSnippetStore.getState().snippets[0];
expect(s.datasetRefs).toEqual(['Revenue']);
expect(s.spec).toContain('"Revenue"');
expect(s.spec).not.toContain('"Sales"');
});
});
describe('commitUrlSnapshot — create from a fetched body', () => {
test('snapshots the body, infers format from content, and profiles it', () => {
store().startCreate();