pwa and mobile client

This commit is contained in:
azykov@mail.ru
2026-09-29 15:55:25 +03:00
parent 657009bd6c
commit 1935acf2ff
96 changed files with 8370 additions and 58 deletions
+28
View File
@@ -124,6 +124,34 @@ describe('client API', () => {
expect((await theirs('DELETE', `/cards/${mine.id}`)).statusCode).toBe(404);
});
it('stores a multiline comment and keeps it on partial updates', async () => {
const { app, key } = await setup();
const api = client(app, key);
const comment = 'Line one\nLine two\n\n indented';
const created = (await api('POST', '/cards', [...cardParts(), { name: 'comment', value: ' Line one\r\nLine two\r\n\r\n indented\n' }])).json() as Card;
expect(created.comment).toBe(comment);
const renamed = (await api('PUT', `/cards/${created.id}`, [{ name: 'name', value: 'Renamed' }])).json() as Card;
expect(renamed.comment).toBe(comment);
const cleared = (await api('PUT', `/cards/${created.id}`, [{ name: 'comment', value: '' }])).json() as Card;
expect(cleared.comment).toBe('');
expect((await api('PUT', `/cards/${created.id}`, [{ name: 'comment', value: 'x'.repeat(2001) }])).statusCode).toBe(400);
const withoutComment = (await api('POST', '/cards', cardParts())).json() as Card;
expect(withoutComment.comment).toBe('');
const patched = await app.inject({
method: 'PATCH',
url: `/admin/cards/${created.id}`,
headers: adminHeaders,
payload: { comment: 'From admin\nsecond line' },
});
expect((patched.json() as Card).comment).toBe('From admin\nsecond line');
});
it('returns JSON 404 for unknown API routes', async () => {
const { app, key } = await setup();
const res = await client(app, key)('GET', '/nope');