-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathimages.test.js
53 lines (42 loc) · 1.57 KB
/
images.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const testWithServer = require('./helpers/test-with-server');
// testWithServer('Request for Object Page with image', {}, async (t, ctx) => {
// t.plan(3);
// const htmlRequest = {
// method: 'GET',
// url: '/objects/co8094437',
// headers: { Accept: 'application/vnd.api+json' }
// };
// const res = await ctx.server.inject(htmlRequest);
// const response = JSON.parse(res.payload);
// t.equal(res.statusCode, 200, 'Found Object');
// t.ok(response.data.attributes.multimedia, 'Object has images');
// t.ok(response.data.attributes.multimedia[0].processed.large.location, 'Has path');
// t.end();
// });
// testWithServer('Search for Object Page with image', {}, async (t, ctx) => {
// t.plan(3);
// const htmlRequest = {
// method: 'GET',
// url: '/search/objects?q=Soyuz',
// headers: { Accept: 'application/vnd.api+json' }
// };
// const res = await ctx.server.inject(htmlRequest);
// const response = JSON.parse(res.payload);
// t.equal(res.statusCode, 200, 'Succesful request');
// t.ok(response.data[0], 'Got results');
// t.ok(response.data[0].attributes.multimedia, 'First result has image');
// t.end();
// });
testWithServer('Object Page with no image', {}, async (t, ctx) => {
t.plan(2);
const htmlRequest = {
method: 'GET',
url: '/objects/co217511',
headers: { Accept: 'application/vnd.api+json' }
};
const res = await ctx.server.inject(htmlRequest);
const response = JSON.parse(res.payload);
t.equal(res.statusCode, 200, 'Succesful request');
t.ok(response.data, 'Got results');
t.end();
});