koa-lite/test/request/idempotent.js
broucz 4b1a1da652 test: switch all functions to arrow functions
closes #553

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

25 lines
653 B
JavaScript

'use strict';
const request = require('../helpers/context').request;
describe('ctx.idempotent', () => {
describe('when the request method is idempotent', () => {
it('should return true', () => {
['GET', 'HEAD', 'PUT', 'DELETE', 'OPTIONS', 'TRACE'].forEach(check);
function check(method){
const req = request();
req.method = method;
req.idempotent.should.equal(true);
}
});
});
describe('when the request method is not idempotent', () => {
it('should return false', () => {
const req = request();
req.method = 'POST';
req.idempotent.should.equal(false);
});
});
});