Skip to content

Commit

Permalink
Check serve static not in cache (e.g. certbot challenge)
Browse files Browse the repository at this point in the history
  • Loading branch information
tshemsedinov committed Oct 25, 2023
1 parent baf4e35 commit 887eb08
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions application/domain/tests/static.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
name: 'Static server test',

async run(t) {
await t.test('Test to serve without cache', async (t) => {
const filePath = './application/static/demo.txt';
const url = 'http://127.0.0.1:8000/demo.txt';
await node.fsp.unlink(filePath).catch(() => null);
t.after(() => {
node.fsp.unlink(filePath);
});
const data = node.crypto.randomBytes(1024 * 1024);
await node.fsp.writeFile(filePath, data);
const response = await fetch(url);
const msg = `status: ${response.status} expected: 200`;
node.assert.strictEqual(response.status, 200, msg);
});

const tasks = [
{ url: '/', size: 2099 },
{ url: '/console.js', size: 14366 },
Expand Down

0 comments on commit 887eb08

Please sign in to comment.