()
| 67 | |
| 68 | class FixtureServer { |
| 69 | constructor() { |
| 70 | this._app = new Koa(); |
| 71 | this._stateMap = new Map([[DEFAULT_STATE_KEY, Object.create(null)]]); |
| 72 | |
| 73 | this._app.use(async (ctx) => { |
| 74 | // Middleware to handle requests |
| 75 | ctx.set('Access-Control-Allow-Origin', '*'); |
| 76 | ctx.set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE'); |
| 77 | ctx.set( |
| 78 | 'Access-Control-Allow-Headers', |
| 79 | 'Origin, X-Requested-With, Content-Type, Accept', |
| 80 | ); |
| 81 | // Check if it's a request for the current state |
| 82 | if (this._isStateRequest(ctx)) { |
| 83 | ctx.body = this._stateMap.get(CURRENT_STATE_KEY); |
| 84 | } |
| 85 | }); |
| 86 | } |
| 87 | |
| 88 | // Start the fixture server |
| 89 | async start() { |
nothing calls this directly
no test coverage detected