koa-lite/test/response/etag.js

33 lines
758 B
JavaScript
Raw Normal View History

'use strict';
const response = require('../context').response;
2014-07-06 08:43:14 +00:00
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"');
})
2014-07-06 08:43:14 +00:00
})
describe('res.etag', function(){
it('should return etag', function(){
const res = response();
2014-07-06 08:43:14 +00:00
res.etag = '"asdf"';
res.etag.should.equal('"asdf"');
})
})