diff --git a/resource/negotiate.test b/resource/negotiate.test index 719b676dca..50ef667aa8 100644 --- a/resource/negotiate.test +++ b/resource/negotiate.test @@ -140,6 +140,35 @@ test ('Resource JS GET / Accept: application/javascript', async t => { , modified = headers.get ('Last-Modified') + t.ok (modified) + t.equal ( status, 200 ) + t.ok (type.match (accept)) + t.ok (type.match (charset)) + t.ok (length == expected.length) + t.equal ( expected, await response.text `` ) + + server.close `` + t.end () +}) + + +test ('Resource JS GET / Accept: text/javascript', async t => { + + const + accept = 'text/javascript' + , charset = 'charset=utf-8' + , server = (new Server ([ middleware ])).serve `` + , expected = read (`resource/fixtures/index.js`) + , options = { + compress : false + , headers : { accept } } + , response = await fetch (URI, options) + , { status, headers } = response + , type = headers.get ('content-type') + , length = headers.get ('Content-Length') + , modified = headers.get ('Last-Modified') + + t.ok (modified) t.equal ( status, 200 ) t.ok (type.match (accept)) diff --git a/server/index.test b/server/index.test index 80aa3674af..72ad27f038 100644 --- a/server/index.test +++ b/server/index.test @@ -59,7 +59,6 @@ test ('middleware collection dependency injection', async t => { const middleware = context => - !!! console.warn ('WTF') && context.set ('test', 'Hello World') , stack = [ middleware ] @@ -71,8 +70,6 @@ test ('middleware collection dependency injection', async t => { = await fetch (`http://localhost:${process.env.PORT}/`) - console.dir (headers) - t.equal ( headers.get ('test'), 'Hello World' )