Skip to content

Commit

Permalink
nginx-tests: remove unnecessary res.ok assertions (#740)
Browse files Browse the repository at this point in the history
These assertions are followed by more specific assertions on res.status, which provide more helpful error messages on failure.
  • Loading branch information
alxndrsn authored Oct 7, 2024
1 parent 60b354e commit 75e894d
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions test/test-nginx.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ describe('nginx config', () => {
const res = await fetchHttp('/.well-known/acme-challenge');

// then
assert.isFalse(res.ok);
assert.equal(res.status, 301);
assert.equal(res.headers.get('location'), 'https://localhost:9000/.well-known/acme-challenge');
});
Expand All @@ -21,7 +20,6 @@ describe('nginx config', () => {
const res = await fetchHttps('/.well-known/acme-challenge');

// then
assert.isFalse(res.ok);
assert.equal(res.status, 404);
});

Expand All @@ -30,7 +28,6 @@ describe('nginx config', () => {
const res = await fetchHttp('/');

// then
assert.isFalse(res.ok);
assert.equal(res.status, 301);
assert.equal(res.headers.get('location'), 'https://localhost:9000/');
});
Expand All @@ -40,7 +37,6 @@ describe('nginx config', () => {
const res = await fetchHttps('/client-config.json');

// then
assert.isTrue(res.ok);
assert.equal(res.status, 200);
assert.deepEqual(await res.json(), { oidcEnabled: false });
assert.equal(await res.headers.get('cache-control'), 'no-cache');
Expand All @@ -55,7 +51,6 @@ describe('nginx config', () => {
const res = await fetchHttps(staticFile);

// then
assert.isTrue(res.ok);
assert.equal(res.status, 200);
assert.equal(await res.text(), `hi:${staticFile}\n`);
assert.equal(await res.headers.get('cache-control'), 'no-cache');
Expand All @@ -70,7 +65,6 @@ describe('nginx config', () => {
const res = await fetchHttps(staticFile);

// then
assert.isTrue(res.ok);
assert.equal(res.status, 200);
assert.equal(await res.text(), `hi:${staticFile}\n`);
assert.isNull(await res.headers.get('cache-control'));
Expand All @@ -82,7 +76,6 @@ describe('nginx config', () => {
const res = await fetchHttps('/-/some/enketo/path');

// then
assert.isTrue(res.ok);
assert.equal(res.status, 200);
assert.equal(await res.text(), 'OK');
// and
Expand All @@ -96,7 +89,6 @@ describe('nginx config', () => {
const res = await fetchHttps('/v1/some/central-backend/path');

// then
assert.isTrue(res.ok);
assert.equal(res.status, 200);
assert.equal(await res.text(), 'OK');
// and
Expand Down

0 comments on commit 75e894d

Please sign in to comment.