@@ -14,7 +14,7 @@ describe('formats', function () {
1414
1515 var server = supertest ( address ) ;
1616 describe ( 'HTML' , function ( ) {
17- it ( 'Should return "Hello, World!"' , function ( done ) {
17+ it ( 'Should return HTML containing "Hello, World!" if Accept is set to text/html ' , function ( done ) {
1818 server . get ( '/hello.html' )
1919 . set ( 'accept' , 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5' )
2020 . expect ( 'Content-type' , / t e x t \/ h t m l / )
@@ -27,13 +27,13 @@ describe('formats', function () {
2727 var isValidJSON = function ( res ) {
2828 var json = JSON . parse ( res . text ) ;
2929 } ;
30- it ( 'Should return JSON-LD document' , function ( done ) {
30+ it ( 'Should return JSON-LD document if Accept is set to application/ld+json ' , function ( done ) {
3131 server . get ( '/patch-5-initial.ttl' )
3232 . set ( 'accept' , 'application/ld+json;q=0.9,text/turtle;q=0.8,text/plain;q=0.7,*/*;q=0.5' )
3333 . expect ( 'content-type' , / a p p l i c a t i o n \/ l d \+ j s o n / )
3434 . expect ( 200 , done ) ;
3535 } ) ;
36- it ( 'Should return valid JSON' , function ( done ) {
36+ it ( 'Should return valid JSON if Accept is set to JSON-LD ' , function ( done ) {
3737 server . get ( '/patch-5-initial.ttl' )
3838 . set ( 'accept' , 'application/ld+json;q=0.9,text/turtle;q=0.8,text/plain;q=0.7,*/*;q=0.5' )
3939 . expect ( isValidJSON )
@@ -42,7 +42,7 @@ describe('formats', function () {
4242 } ) ;
4343
4444 describe ( 'N-Quads' , function ( ) {
45- it ( 'Should return N-Quads document' , function ( done ) {
45+ it ( 'Should return N-Quads document is Accept is set to application/n-quads ' , function ( done ) {
4646 server . get ( '/patch-5-initial.ttl' )
4747 . set ( 'accept' , 'application/n-quads;q=0.9,text/turtle;q=0.8,text/plain;q=0.7,*/*;q=0.5' )
4848 . expect ( 'content-type' , / a p p l i c a t i o n \/ n - q u a d s / )
@@ -51,11 +51,19 @@ describe('formats', function () {
5151 } ) ;
5252
5353 describe ( 'n3' , function ( ) {
54- it ( 'Should return turtle document if content-type set to n3' , function ( done ) {
54+ it ( 'Should return turtle document if Accept is set to text/ n3' , function ( done ) {
5555 server . get ( '/patch-5-initial.ttl' )
5656 . set ( 'accept' , 'text/n3;q=0.9,text/turtle;q=0.8,text/plain;q=0.7,*/*;q=0.5' )
5757 . expect ( 'content-type' , / t e x t \/ n 3 / )
5858 . expect ( 200 , done ) ;
5959 } ) ;
6060 } ) ;
61+
62+ describe ( 'none' , function ( ) {
63+ it ( 'Should return turtle document if no Accept header is set' , function ( done ) {
64+ server . get ( '/patch-5-initial.ttl' )
65+ . expect ( 'content-type' , / t e x t \/ t u r t l e / )
66+ . expect ( 200 , done ) ;
67+ } ) ;
68+ } ) ;
6169} ) ;
0 commit comments