From 887eb08cb05d28354b3371039d022ad74150b6c9 Mon Sep 17 00:00:00 2001 From: Timur Shemsedinov Date: Tue, 24 Oct 2023 21:08:56 +0300 Subject: [PATCH] Check serve static not in cache (e.g. certbot challenge) --- application/domain/tests/static.test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/application/domain/tests/static.test.js b/application/domain/tests/static.test.js index b6822f86..659bc529 100644 --- a/application/domain/tests/static.test.js +++ b/application/domain/tests/static.test.js @@ -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 },