koa-lite/test/response/last-modified.js
broucz 4b1a1da652 test: switch all functions to arrow functions
closes 

Update test: application -> use() should throw if not a function

Fix lint

Use arrow function

Refactor test using arrow function

Remove non mandatory brackets

fix for merge

Fix: missing refactor after merge

Use arrow function for old generator
2015-11-02 11:22:05 -08:00

35 lines
1 KiB
JavaScript

'use strict';
const response = require('../helpers/context').response;
describe('res.lastModified', () => {
it('should set the header as a UTCString', () => {
const res = response();
const date = new Date();
res.lastModified = date;
res.header['last-modified'].should.equal(date.toUTCString());
});
it('should work with date strings', () => {
const res = response();
const date = new Date();
res.lastModified = date.toString();
res.header['last-modified'].should.equal(date.toUTCString());
});
it('should get the header as a Date', () => {
// Note: Date() removes milliseconds, but it's practically important.
const res = response();
const date = new Date();
res.lastModified = date;
(res.lastModified.getTime() / 1000).should.equal(Math.floor(date.getTime() / 1000));
});
describe('when lastModified not set', () => {
it('should get undefined', () => {
const res = response();
(res.lastModified === undefined).should.be.ok;
});
});
});