Move src/ → apps/server/ and packages/web/ → apps/web/ to adopt standard monorepo conventions (apps/ for runnable apps, packages/ for reusable libraries). Update all config files, shared package imports, test fixtures, and documentation to reflect new paths. Key fixes: - Update workspace config to ["apps/*", "packages/*"] - Update tsconfig.json rootDir/include for apps/server/ - Add apps/web/** to vitest exclude list - Update drizzle.config.ts schema path - Fix ensure-schema.ts migration path detection (3 levels up in dev, 2 levels up in dist) - Fix tests/integration/cli-server.test.ts import paths - Update packages/shared imports to apps/server/ paths - Update all docs/ files with new paths
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { TodoStore } from './todo.js';
|
|
|
|
test('add returns an id', () => {
|
|
const store = new TodoStore();
|
|
const id = store.add('buy milk');
|
|
assert.ok(typeof id === 'number', 'id should be a number');
|
|
});
|
|
|
|
test('list returns all items', () => {
|
|
const store = new TodoStore();
|
|
store.add('task one');
|
|
store.add('task two');
|
|
assert.equal(store.list().length, 2);
|
|
});
|
|
|
|
test('remove deletes an item', () => {
|
|
const store = new TodoStore();
|
|
const id = store.add('delete me');
|
|
store.remove(id);
|
|
assert.equal(store.list().length, 0);
|
|
});
|
|
|
|
test('complete marks item done', () => {
|
|
const store = new TodoStore();
|
|
const id = store.add('buy milk');
|
|
store.complete(id);
|
|
const item = store.list().find(i => i.id === id);
|
|
assert.ok(item, 'item should still exist after completing');
|
|
assert.equal(item.done, true, 'item.done should be true after complete()');
|
|
});
|
|
|
|
test('complete does not affect other items', () => {
|
|
const store = new TodoStore();
|
|
const id1 = store.add('task one');
|
|
const id2 = store.add('task two');
|
|
store.complete(id1);
|
|
const item2 = store.list().find(i => i.id === id2);
|
|
assert.equal(item2.done, false, 'other items should remain undone');
|
|
});
|