Skip to content

Commit 1377eaa

Browse files
committed
test: ensure properties assertions on file http specs
1 parent 62a0291 commit 1377eaa

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

test/file.http.spec.js

+26-10
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,41 @@ import {
55
import {
66
clear as clearHttp,
77
testRouter,
8-
testUpload,
98
} from '@lykmapipo/express-test-helpers';
109
import fileRouter from '../src/file.http.router';
1110

11+
const properties = [
12+
'length',
13+
'chunkSize',
14+
'uploadDate',
15+
'md5',
16+
'filename',
17+
'contentType',
18+
'aliases',
19+
'metadata',
20+
'_id',
21+
'__v',
22+
];
23+
24+
const options = {
25+
pathSingle: '/files/:bucket/:id',
26+
pathList: '/files/:bucket',
27+
pathSchema: '/files/:bucket/schema',
28+
};
29+
1230
describe.only('HTTP API', () => {
1331
before(() => clearHttp());
1432
before(done => clearDatabase(done));
1533

16-
const options = {
17-
pathSingle: '/files/:bucket/:id',
18-
pathList: '/files/:bucket',
19-
pathSchema: '/files/:bucket/schema',
20-
};
21-
22-
expect(testUpload).to.exist;
23-
2434
it('should handle HTTP GET on /files/:bucket/schema', done => {
2535
const { testGetSchema } = testRouter(options, fileRouter);
26-
testGetSchema({ bucket: 'files' }).expect(200, done);
36+
testGetSchema({ bucket: 'files' }).expect(200, (error, { body }) => {
37+
expect(error).to.not.exist;
38+
expect(body).to.exist;
39+
expect(body).to.have.all.keys('title', 'type', 'properties');
40+
expect(body.properties).to.have.all.keys(...properties);
41+
done(error, body);
42+
});
2743
});
2844

2945
after(() => clearHttp());

0 commit comments

Comments
 (0)