All files / src/scenarios rooms-index.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48                              2x                 2x                 2x                 2x          
import type { HttpScenario } from '@ethercalc/shared/oracle-scenarios';
 
/**
 * Room-index scenarios — `/_rooms`, `/_roomlinks`, `/_roomtimes`.
 *
 * On a fresh oracle (no rooms created) `_rooms` and `_roomtimes`
 * return empty JSON containers (array / object) and `_roomlinks`
 * returns an empty array serialized as HTML (preserving the legacy
 * bug where the handler sets `Content-Type: text/html` but writes
 * JSON — see CLAUDE.md §6.1 "Behaviors requiring bug-for-bug
 * preservation"). These only hold while Redis is empty; record.ts's
 * orchestrator is responsible for not creating rooms before hitting
 * these paths.
 */
 
export const GET_ROOMS_EMPTY: HttpScenario = {
  name: 'rooms-index/get-rooms-empty',
  kind: 'http',
  request: {
    method: 'GET',
    path: '/_rooms',
  },
};
 
export const GET_ROOMLINKS_EMPTY: HttpScenario = {
  name: 'rooms-index/get-roomlinks-empty',
  kind: 'http',
  request: {
    method: 'GET',
    path: '/_roomlinks',
  },
};
 
export const GET_ROOMTIMES_EMPTY: HttpScenario = {
  name: 'rooms-index/get-roomtimes-empty',
  kind: 'http',
  request: {
    method: 'GET',
    path: '/_roomtimes',
  },
};
 
export const ROOMS_INDEX_SCENARIOS: readonly HttpScenario[] = [
  GET_ROOMS_EMPTY,
  GET_ROOMLINKS_EMPTY,
  GET_ROOMTIMES_EMPTY,
];