Skip to content
Myr

exports.js

This file

Path

test/exports.js

82 lines · 2.3 KiB · JavaScript

Last changed by

fix(refactor): prefix built-in node module importsSzymon Łągiewkabefore adoption4111359

History of this file

Take it

The walk stopped after 200 commits: lines older than 2027b87 point at it.

fix(deps): cookie@0.7.0Josh Bukerbefore adoption2027b87

lines 1–2why, one step back
1'use strict'
2

fix(refactor): prefix built-in node module importsSzymon Łągiewkabefore adoption4111359

line 3why, one step back
3var assert = require('node:assert')

fix(deps): cookie@0.7.0Josh Bukerbefore adoption2027b87

lines 4–82why, one step back
4var express = require('../');
5var request = require('supertest');67describe('exports', function(){8 it('should expose Router', function(){9 assert.strictEqual(typeof express.Router, 'function')10 })1112 it('should expose json middleware', function () {13 assert.equal(typeof express.json, 'function')14 assert.equal(express.json.length, 1)15 })1617 it('should expose raw middleware', function () {18 assert.equal(typeof express.raw, 'function')19 assert.equal(express.raw.length, 1)20 })2122 it('should expose static middleware', function () {23 assert.equal(typeof express.static, 'function')24 assert.equal(express.static.length, 2)25 })2627 it('should expose text middleware', function () {28 assert.equal(typeof express.text, 'function')29 assert.equal(express.text.length, 1)30 })3132 it('should expose urlencoded middleware', function () {33 assert.equal(typeof express.urlencoded, 'function')34 assert.equal(express.urlencoded.length, 1)35 })3637 it('should expose the application prototype', function(){38 assert.strictEqual(typeof express.application, 'object')39 assert.strictEqual(typeof express.application.set, 'function')40 })4142 it('should expose the request prototype', function(){43 assert.strictEqual(typeof express.request, 'object')44 assert.strictEqual(typeof express.request.accepts, 'function')45 })4647 it('should expose the response prototype', function(){48 assert.strictEqual(typeof express.response, 'object')49 assert.strictEqual(typeof express.response.send, 'function')50 })5152 it('should permit modifying the .application prototype', function(){53 express.application.foo = function(){ return 'bar'; };54 assert.strictEqual(express().foo(), 'bar')55 })5657 it('should permit modifying the .request prototype', function(done){58 express.request.foo = function(){ return 'bar'; };59 var app = express();6061 app.use(function(req, res, next){62 res.end(req.foo());63 });6465 request(app)66 .get('/')67 .expect('bar', done);68 })6970 it('should permit modifying the .response prototype', function(done){71 express.response.foo = function(){ this.send('bar'); };72 var app = express();7374 app.use(function(req, res, next){75 res.foo();76 });7778 request(app)79 .get('/')80 .expect('bar', done);81 })82})