koa-lite/test/response/etag.js
Tejas Manohar e8f79d43f9 modularize tests for application
closes #517

add index test for Application

add app.toJSON test

add test for app.inspect()

add tests for app.use()

add tests for app.onerror()

add tests for app.respond()

add tests for app.context()

add tests for app.request()

add tests for app.response

refactor for non-existence of test/app...js

no need for *.js

use helpers/ dir for non-tests
2015-10-12 00:08:06 -07:00

32 lines
766 B
JavaScript

'use strict';
const response = require('../helpers/context').response;
describe('res.etag=', function(){
it('should not modify an etag with quotes', function(){
const res = response();
res.etag = '"asdf"';
res.header.etag.should.equal('"asdf"');
})
it('should not modify a weak etag', function(){
const res = response();
res.etag = 'W/"asdf"';
res.header.etag.should.equal('W/"asdf"');
})
it('should add quotes around an etag if necessary', function(){
const res = response();
res.etag = 'asdf';
res.header.etag.should.equal('"asdf"');
})
})
describe('res.etag', function(){
it('should return etag', function(){
const res = response();
res.etag = '"asdf"';
res.etag.should.equal('"asdf"');
})
})