@@ -10,50 +10,35 @@ const server = setupSuperServer({
1010 webid : false
1111} )
1212
13- describe ( 'Validate HTTP requests with Turtle syntax' , function ( ) {
14- describe ( 'PUT API' , function ( ) {
15- const putRequestBody = fs . readFileSync ( path . join ( __dirname , '../resources/sampleContainer/invalid.ttl' ) , {
16- 'encoding' : 'utf8'
13+ const invalidTurtleBody = fs . readFileSync ( path . join ( __dirname , '../resources/invalid1.ttl' ) , {
14+ 'encoding' : 'utf8'
15+ } )
16+
17+ describe ( 'HTTP requests with invalid Turtle syntax' , ( ) => {
18+ describe ( 'PUT API' , ( ) => {
19+ it ( 'should return 400' , ( done ) => {
20+ server . put ( '/should-not-be-created.ttl' )
21+ . send ( invalidTurtleBody )
22+ . set ( 'content-type' , 'text/turtle' )
23+ . expect ( 400 , done )
1724 } )
18- it ( 'should return 400' , function ( done ) {
19- server . put ( '/put-resource-1.ttl' )
20- . send ( putRequestBody )
25+ } )
26+
27+ describe . skip ( 'PATCH API' , ( ) => {
28+ it ( 'should return 400' , ( done ) => { // TODO: This returns 415 right now
29+ server . patch ( '/patch-1-initial.ttl' )
30+ . send ( invalidTurtleBody )
2131 . set ( 'content-type' , 'text/turtle' )
2232 . expect ( 400 , done )
2333 } )
2434 } )
2535
26- // describe('POST (multipart)', function () {
27- // it('should create as many files as the ones passed in multipart',
28- // function (done) {
29- // server.post('/sampleContainer/')
30- // .attach('timbl', path.join(__dirname, '../resources/timbl.jpg'))
31- // .attach('nicola', path.join(__dirname, '../resources/nicola.jpg'))
32- // .expect(200)
33- // .end(function (err) {
34- // if (err) return done(err)
35- //
36- // var sizeNicola = fs.statSync(path.join(__dirname,
37- // '../resources/nicola.jpg')).size
38- // var sizeTim = fs.statSync(path.join(__dirname, '../resources/timbl.jpg')).size
39- // var sizeNicolaLocal = fs.statSync(path.join(__dirname,
40- // '../resources/sampleContainer/nicola.jpg')).size
41- // var sizeTimLocal = fs.statSync(path.join(__dirname,
42- // '../resources/sampleContainer/timbl.jpg')).size
43- //
44- // if (sizeNicola === sizeNicolaLocal && sizeTim === sizeTimLocal) {
45- // return done()
46- // } else {
47- // return done(new Error('Either the size (remote/local) don\'t match or files are not stored'))
48- // }
49- // })
50- // })
51- // after(function () {
52- // // Clean up after POST (multipart) API tests
53- // return Promise.all([
54- // rm('/sampleContainer/nicola.jpg'),
55- // rm('/sampleContainer/timbl.jpg')
56- // ])
57- // })
58- // })
36+ describe . skip ( 'POST API (multipart)' , ( ) => { // TODO: Is this something we should validate?
37+ it ( 'should create as many files as the ones passed in multipart' , ( done ) => {
38+ server . post ( '/' )
39+ . attach ( 'timbl' , path . join ( __dirname , '../resources/invalid1.ttl' ) )
40+ . attach ( 'nicola' , path . join ( __dirname , '../resources/invalid2.ttl' ) )
41+ . expect ( 400 , done )
42+ } )
43+ } )
5944} )
0 commit comments