9b395f5cc3
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
import { describe, expect, it } from 'vitest';
|
|
import { getTopicText, toTopicRow } from './utils.js';
|
|
|
|
describe('zsxq utils', () => {
|
|
it('keeps title and content separate when both fields exist', () => {
|
|
const topic = {
|
|
topic_id: '123',
|
|
title: 'A full title that should not be truncated',
|
|
talk: { text: 'This is the full body text.' },
|
|
};
|
|
|
|
expect(getTopicText(topic)).toBe('A full title that should not be truncated');
|
|
expect(toTopicRow(topic)).toMatchObject({
|
|
title: 'A full title that should not be truncated',
|
|
content: 'This is the full body text.',
|
|
});
|
|
});
|
|
|
|
it('falls back to body text for title when explicit title is absent', () => {
|
|
const topic = {
|
|
topic_id: '456',
|
|
talk: { text: 'Body-only topic text should still appear as the title preview.' },
|
|
};
|
|
|
|
expect(getTopicText(topic)).toBe('Body-only topic text should still appear as the title preview.');
|
|
expect(toTopicRow(topic)).toMatchObject({
|
|
title: 'Body-only topic text should still appear as the title preview.',
|
|
content: 'Body-only topic text should still appear as the title preview.',
|
|
});
|
|
});
|
|
});
|