Node.js Integration Tests

JS
S
JavaScript

Integration tests with supertest. To run the tests: jest --forceExit Tests files located at: /test/integration/api.test.ts https://www.npmjs.com/package/supertest

1import * as supertest from 'supertest';
2
3const request = supertest('http://sampler.io/?cid=100&campid=999&bsz=999x999&bv=1&other=random&adurl=https://coderecipes.org/search?q=cheatsheet');
4
5describe('GET coderecipes.io', () => {
6  it('should return 200 OK', () => {
7    return request.get('/')
8      .expect(302)
9      .expect('Cache-Control', 'no-cache')
10      .expect('Content-Length', '0')
11      .expect('Pragma', 'no-cache')
12      .expect('Referrer-Policy', 'same-origin')
13      .expect('X-Content-Type-Options', 'nosniff')
14      .expect('X-Cache', 'Miss from cloudfront');
15  });
16});
17

Created on 6/20/2018