tobogganSe connecter

starfleet-ui

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

16 lignes · 545 octetsBrut · Historique
1import { describe, expect, test } from 'bun:test';
2import { resumeId } from './sse';
3
4describe('resumeId', () => {
5 test("prefers the browser's own Last-Event-ID (a reconnect)", () => {
6 expect(resumeId('42', '17')).toBe('42');
7 });
8 test('falls back to the page-supplied ?after=', () => {
9 expect(resumeId(null, '17')).toBe('17');
10 });
11 test('ignores anything that is not an entry number', () => {
12 expect(resumeId('abc', '17')).toBe('17');
13 expect(resumeId(null, '1; drop')).toBeNull();
14 expect(resumeId(null, null)).toBeNull();
15 });
16});