Skip to content

Commit bc3f130

Browse files
author
deiu
committed
Added proper tests for conneg
1 parent a1fe4c5 commit bc3f130

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

‎test/formats.js‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ var fs = require('fs');
55
var S = require('string');
66
var ldnode = require('../index');
77

8-
var accepts = 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
9-
108
describe('formats', function () {
119
var address = 'http://localhost:3457';
1210
var ldp = ldnode.createServer({
@@ -18,6 +16,7 @@ describe('formats', function () {
1816
describe('HTML', function() {
1917
it('Should return "Hello, World!"', function(done) {
2018
server.get('/hello.html')
19+
.set('accept', 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5')
2120
.expect('Content-type', /text\/html/)
2221
.expect(/Hello, world!/)
2322
.expect(200, done);
@@ -30,13 +29,13 @@ describe('formats', function () {
3029
};
3130
it('Should return JSON-LD document', function(done) {
3231
server.get('/patch-5-initial.ttl')
33-
.set('accept', 'application/ld+json')
32+
.set('accept', 'application/ld+json;q=0.9,text/turtle;q=0.8,text/plain;q=0.7,*/*;q=0.5')
3433
.expect('content-type', /application\/ld\+json/)
3534
.expect(200, done);
3635
});
3736
it('Should return valid JSON', function(done) {
3837
server.get('/patch-5-initial.ttl')
39-
.set('accept', 'application/ld+json')
38+
.set('accept', 'application/ld+json;q=0.9,text/turtle;q=0.8,text/plain;q=0.7,*/*;q=0.5')
4039
.expect(isValidJSON)
4140
.expect(200, done);
4241
});
@@ -45,7 +44,7 @@ describe('formats', function () {
4544
describe('N-Quads', function() {
4645
it('Should return N-Quads document', function(done) {
4746
server.get('/patch-5-initial.ttl')
48-
.set('accept', 'application/n-quads')
47+
.set('accept', 'application/n-quads;q=0.9,text/turtle;q=0.8,text/plain;q=0.7,*/*;q=0.5')
4948
.expect('content-type', /application\/n-quads/)
5049
.expect(200, done);
5150
});
@@ -54,7 +53,7 @@ describe('formats', function () {
5453
describe('n3', function() {
5554
it('Should return turtle document if content-type set to n3', function(done) {
5655
server.get('/patch-5-initial.ttl')
57-
.set('accept', 'text/n3')
56+
.set('accept', 'text/n3;q=0.9,text/turtle;q=0.8,text/plain;q=0.7,*/*;q=0.5')
5857
.expect('content-type', /text\/n3/)
5958
.expect(200, done);
6059
});

0 commit comments

Comments
 (0)