mirror of
https://github.com/bitbaum/substrata.git
synced 2026-12-04 04:27:32 +01:00
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>
21 lines
691 B
TypeScript
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);
|
|
});
|