Files
substrata/test/threadkit.test.ts
CatoandClaude 0f1ee65825 chore(deps): threadkit from the @bitbaum scope (canary bootstrap) (#362)
substrata is the designated canary for threadkit; the fleet's rollout gate holds
every adopter until the canary has adopted a new package name. Same code and
version, now published as @bitbaum/threadkit 0.1.1.


Claude-Session: https://claude.ai/code/session_019MDtmvpWNTLxXNfwUHS7MD

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 10:45:49 +01:00

21 lines
691 B
TypeScript

import { test } from 'node:test';
import assert from 'node:assert/strict';
import { canWrite, visibleMessages } from '@bitbaum/threadkit';
import { pageThread } from '../lib/page-thread';
test('page threads let a signed-in reader write and a public observer only read', () => {
const thread = pageThread('/notes/demo', ['actor-1']);
assert.equal(canWrite(thread, 'actor-1'), true);
assert.equal(canWrite(thread, 'public'), false);
const messages = [
{
id: '1',
threadId: '/notes/demo',
authorId: 'actor-1',
body: 'A sourced correction.',
createdAt: new Date(),
},
];
assert.equal(visibleMessages(thread, 'public', messages).length, 1);
});