MCPcopy Create free account
hub / github.com/cfworker/cfworker / assertWatchesForChanges

Function assertWatchesForChanges

packages/dev/test/run-command.spec.js:75–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73}
74
75export async function assertWatchesForChanges() {
76 const entry = './test/fixtures/worker.js';
77 let code = `console.log('hello world')`;
78 await fs.outputFile(entry, code);
79 const command = new RunCommand({
80 entry,
81 port,
82 inspect: false,
83 watch: true,
84 check: true,
85 kv: []
86 });
87 await command.execute();
88 let response = await fetch('http://localhost:7000');
89 assert.equal(response.status, 503);
90
91 const updated = new Promise(resolve =>
92 command.host.on('worker-updated', resolve)
93 );
94 code = `
95 // @ts-ignore
96 addEventListener('fetch', e => e.respondWith(new Response('', { status: 200 })))`;
97 await fs.outputFile(entry, code);
98 await updated;
99 response = await fetch('http://localhost:7000');
100 assert.equal(response.status, 200);
101
102 command.dispose();
103}
104
105export async function assertCanReadRequestCookieHeader() {
106 const cookie = 'test cookie';

Callers

nothing calls this directly

Calls 3

executeMethod · 0.95
disposeMethod · 0.95
onMethod · 0.80

Tested by

no test coverage detected