Skip to content

Commit

Permalink
removed http test
Browse files Browse the repository at this point in the history
  • Loading branch information
dksung101 committed Nov 15, 2024
1 parent 5cc198b commit 99332db
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
Binary file modified dump.rdb
Binary file not shown.
37 changes: 0 additions & 37 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,43 +472,6 @@ describe('API', async () => {
}
});

// Recursively iterate through schema properties, comparing type
it('response body should match schema definition', () => {
const http302 = context[method].responses['302'];
if (http302 && result.response.statusCode === 302) {
// Compare headers instead
const expectedHeaders = Object.keys(http302.headers).reduce((memo, name) => {
const value = http302.headers[name].schema.example;
memo[name] = value.startsWith(nconf.get('relative_path')) ? value : nconf.get('relative_path') + value;
return memo;
}, {});

for (const header of Object.keys(expectedHeaders)) {
assert(result.response.headers[header.toLowerCase()]);
assert.strictEqual(result.response.headers[header.toLowerCase()], expectedHeaders[header]);
}
return;
}

if (result.response.statusCode === 400 && context[method].responses['400']) {
// TODO: check 400 schema to response.body?
return;
}

const http200 = context[method].responses['200'];
if (!http200) {
return;
}

const hasJSON = http200.content && http200.content['application/json'];
if (hasJSON) {
schema = context[method].responses['200'].content['application/json'].schema;
compare(schema, result.body, method.toUpperCase(), path, 'root');
}

// TODO someday: text/csv, binary file type checking?
});

it('should successfully re-login if needed', async () => {
const reloginPaths = ['GET /api/user/{userslug}/edit/email', 'PUT /users/{uid}/password', 'DELETE /users/{uid}/sessions/{uuid}'];
if (reloginPaths.includes(`${method.toUpperCase()} ${path}`)) {
Expand Down

0 comments on commit 99332db

Please sign in to comment.