Skip to content

Commit 887eb08

Browse files
committed
Check serve static not in cache (e.g. certbot challenge)
1 parent baf4e35 commit 887eb08

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

application/domain/tests/static.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22
name: 'Static server test',
33

44
async run(t) {
5+
await t.test('Test to serve without cache', async (t) => {
6+
const filePath = './application/static/demo.txt';
7+
const url = 'http://127.0.0.1:8000/demo.txt';
8+
await node.fsp.unlink(filePath).catch(() => null);
9+
t.after(() => {
10+
node.fsp.unlink(filePath);
11+
});
12+
const data = node.crypto.randomBytes(1024 * 1024);
13+
await node.fsp.writeFile(filePath, data);
14+
const response = await fetch(url);
15+
const msg = `status: ${response.status} expected: 200`;
16+
node.assert.strictEqual(response.status, 200, msg);
17+
});
18+
519
const tasks = [
620
{ url: '/', size: 2099 },
721
{ url: '/console.js', size: 14366 },

0 commit comments

Comments
 (0)