mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Services: delete dead RelationshipService; rename persistence to snippet-persistence
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user