Skip to content
Myr

req.fresh.js

This file

Path

test/req.fresh.js

36 lines · 807 bytes · JavaScript

Last changed by

tests: add more etag testsDouglas Christopher Wilsonbefore adoption3e35845

History of this file

Take it

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

pin jade dev dep so tests do not breakTJ Holowaychukbefore adoptiona10f695

lines 1–2why, one step back
1
2var express = require('../')

remove unnecessary test/support/httpJonathan Ongbefore adoption328c6d3

line 3why, one step back
3 , request = require('supertest');

pin jade dev dep so tests do not breakTJ Holowaychukbefore adoptiona10f695

lines 4–8why, one step back
4
5describe('req', function(){6 describe('.fresh', function(){7 it('should return true when the resource is not modified', function(done){8 var app = express();

tests: add more etag testsDouglas Christopher Wilsonbefore adoption3e35845

line 9why, one step back
9 var etag = '"12345"';

pin jade dev dep so tests do not breakTJ Holowaychukbefore adoptiona10f695

lines 10–11why, one step back
10
11 app.use(function(req, res){

tests: add more etag testsDouglas Christopher Wilsonbefore adoption3e35845

line 12why, one step back
12 res.set('ETag', etag);

pin jade dev dep so tests do not breakTJ Holowaychukbefore adoptiona10f695

lines 13–17why, one step back
13 res.send(req.fresh);
14 });1516 request(app)17 .get('/')

tests: add more etag testsDouglas Christopher Wilsonbefore adoption3e35845

line 18why, one step back
18 .set('If-None-Match', etag)

pin jade dev dep so tests do not breakTJ Holowaychukbefore adoptiona10f695

lines 19–25why, one step back
19 .expect(304, done);
20 })2122 it('should return false when the resource is modified', function(done){23 var app = express();2425 app.use(function(req, res){

tests: add more etag testsDouglas Christopher Wilsonbefore adoption3e35845

line 26why, one step back
26 res.set('ETag', '"123"');

pin jade dev dep so tests do not breakTJ Holowaychukbefore adoptiona10f695

lines 27–31why, one step back
27 res.send(req.fresh);
28 });2930 request(app)31 .get('/')

tests: add more etag testsDouglas Christopher Wilsonbefore adoption3e35845

lines 32–33why, one step back
32 .set('If-None-Match', '"12345"')
33 .expect(200, 'false', done);

pin jade dev dep so tests do not breakTJ Holowaychukbefore adoptiona10f695

lines 34–36why, one step back
34 })
35 })36})