/
githubmirror
/
express
Обзор
Документация
Войти
/
githubmirror
/
express
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
4.17.2
test/req.acceptsCharsets.js
48 строк
1 KB
김정환
tests: fix typos in descriptions
16 апр 2019, 19:40
16 апр 2019, 19:40
b9b1b19
Код
Авторство
О чём код?
var express = require('../') , request = require('supertest'); describe('req', function(){ describe('.acceptsCharsets(type)', function(){ describe('when Accept-Charset is not present', function(){ it('should return true', function(done){ var app = express(); app.use(function(req, res, next){ res.end(req.acceptsCharsets('utf-8') ? 'yes' : 'no'); }); request(app) .get('/') .expect('yes', done); }) }) describe('when Accept-Charset is present', function () { it('should return true', function (done) { var app = express(); app.use(function(req, res, next){ res.end(req.acceptsCharsets('utf-8') ? 'yes' : 'no'); }); request(app) .get('/') .set('Accept-Charset', 'foo, bar, utf-8') .expect('yes', done); }) it('should return false otherwise', function(done){ var app = express(); app.use(function(req, res, next){ res.end(req.acceptsCharsets('utf-8') ? 'yes' : 'no'); }); request(app) .get('/') .set('Accept-Charset', 'foo, bar') .expect('no', done); }) }) }) })