Merge pull request #82 from KevinMidboe/testing

Testing
This commit is contained in:
2018-02-07 14:41:05 +01:00
committed by GitHub
2 changed files with 19 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
const assert = require('assert');
const createCacheEntry = require('test/helpers/createCacheEntry');
const resetDatabase = require('test/helpers/resetDatabase');
const request = require('supertest-as-promised');
const app = require('src/webserver/app');
const popularShowsSuccess = require('test/fixtures/popular-show-success-response.json');
describe('As a user I want to get popular shows', () => {
before(() => resetDatabase());
before(() => createCacheEntry('p:show::1', popularShowsSuccess));
it('should return 200 with the information', () =>
request(app)
.get('/api/v1/tmdb/list/popular?type=show')
.expect(200)
.then(response => assert.equal(response.body.results.length, 20))
);
});