feat(migrate): ensureSpace helper
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
14
tests/migrate/spaces.test.js
Normal file
14
tests/migrate/spaces.test.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { describe, it, expect, beforeAll } from 'vitest';
|
||||
import { resetDb } from '../helpers/db.js';
|
||||
import { migrateUp } from '../../lib/db/migrate.js';
|
||||
import { ensureSpace } from '../../migrate/spaces.js';
|
||||
|
||||
beforeAll(async () => { await resetDb(); await migrateUp(); });
|
||||
|
||||
describe('ensureSpace', () => {
|
||||
it('creates a space once and reuses it by slug', async () => {
|
||||
const a = await ensureSpace('void1', 'Void 1');
|
||||
const b = await ensureSpace('void1', 'Void 1');
|
||||
expect(a).toBe(b);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user