Add mock data and unit tests for Channels and Members APIs

This commit is contained in:
2025-12-07 04:41:41 -05:00
parent 4673547b95
commit a88fa40ba2
12 changed files with 1377 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import {describe, expect, it} from 'bun:test';
import assertUnreachable from '../../../src/lang/assertUnreachable';
describe('assertUnreachable', () => {
describe('when called with an unexpected value', () => {
it('should throw an error containing the value', () => {
const unreachableValue = 'unexpected' as never;
expect(() => assertUnreachable(unreachableValue)).toThrow('Unreachable code: unexpected');
});
it('should handle numeric values in the error message', () => {
const numericValue = 42 as never;
expect(() => assertUnreachable(numericValue)).toThrow('Unreachable code: 42');
});
it('should always throw and never return', () => {
const value = 'test' as never;
let didThrow = false;
try {
assertUnreachable(value);
} catch {
didThrow = true;
}
expect(didThrow).toBe(true);
});
});
});