This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
SA3/hw4/Claudio_Maggioni/tests/test/ex7.test.js

37 lines
1 KiB
JavaScript
Raw Normal View History

2019-10-11 13:00:35 +00:00
const request = require('supertest')
, config = require('./config')
, should = require('should')
// expected jsons
, expectedTuring = require('./expected-turing')
, expectedSimple = require('./expected-simple');
const baseURL = config.baseURL;
describe('Exercise 7. JSON Tag Cloud ', function(){
it('should work for simple ...', function(done){
request(baseURL)
.get('/cloud?file=simple.txt')
.set('Accept', 'application/json')
.expect(200)
.expect('Content-Type', /application\/json/)
.expect(expectedSimple, done)
});
it('and complex texts', function(done){
request(baseURL)
.get('/cloud?file=turing.txt')
.set('Accept', 'application/json')
.expect(200)
.expect('Content-Type', /application\/json/)
.expect(expectedTuring, done)
});
it('should still support regular requests', function(done){
request(baseURL)
.get('/cloud?file=turing.txt')
.expect(200)
.expect('Content-Type', /text\/html/, done)
});
});