Permalink
Browse files

Removed staticCache tests for now

nested assert.responses fail hard on node 0.5.x

this is not really a "bug" in expresso since
it was never designed to work with nested
responses, but I will fix this asap
  • Loading branch information...
1 parent e8beda3 commit 2c93ba90f5269584e1fa8415349f53acca14951d @tj tj committed Oct 24, 2011
Showing with 1 addition and 194 deletions.
  1. +1 −2 Makefile
  2. +0 −192 test/staticCache.test.js
View
@@ -4,8 +4,7 @@ TESTS ?= test/*.test.js
SRC = $(shell find lib -type f -name "*.js")
test:
- @NODE_ENV=test ./$(TEST) \
- $(TEST_FLAGS) $(TESTS)
+ @NODE_ENV=test ./node_modules/.bin/expresso $(TEST_FLAGS) $(TESTS)
docs:
@mkdir -p docs
View
@@ -1,192 +0,0 @@
-
-/**
- * Module dependencies.
- */
-
-var connect = require('../')
- , assert = require('assert')
- , should = require('should')
- , http = require('http');
-
-/**
- * Path to ./test/fixtures/
- */
-
-var fixturesPath = __dirname + '/fixtures';
-
-var app = connect(
- connect.staticCache(),
- connect.static(fixturesPath, { maxAge: 60000 })
-);
-
-var app2 = connect(
- connect.staticCache(),
- connect.static(fixturesPath, { maxAge: 0 })
-);
-
-
-module.exports = {
-
- 'unconditional request': function() {
- assert.response(
- app,
- { url: '/user.json' },
- function(res) {
- res.statusCode.should.equal(200);
- res.headers.should.have.property('last-modified');
- res.headers.should.have.property('etag');
- assert.response(
- app,
- { url: '/user.json' },
- function(res) {
- res.statusCode.should.equal(200);
- res.headers.should.have.property('date');
- res.headers.should.have.property('last-modified');
- res.headers.should.have.property('etag');
- }
- );
- }
- );
- },
-
- 'ifnonematch request': function() {
- assert.response(
- app,
- { url: '/user.json' },
- function(res) {
- res.statusCode.should.equal(200);
- res.headers.should.have.property('etag');
- assert.response(
- app,
- {
- url: '/user.json',
- headers: {
- "If-None-Match": res.headers.etag
- }
- },
- function(res) {
- res.statusCode.should.equal(304);
- res.headers.should.have.property('date');
- res.headers.should.have.property('last-modified');
- res.headers.should.have.property('etag');
- }
- );
- }
- );
- },
-
- 'old if-none-match request': function() {
- assert.response(
- app,
- { url: '/user.json' },
- function(res) {
- res.statusCode.should.equal(200);
- res.headers.should.have.property('etag');
- assert.response(
- app,
- { url: '/user.json',
- headers: {
- 'If-None-Match': 'foobar'
- }
- },
- function(res) {
- res.statusCode.should.equal(200);
- res.headers.should.have.property('date');
- res.headers.should.have.property('last-modified');
- res.headers.should.have.property('etag');
- }
- );
- }
- );
- },
-
- 'if-modified since request': function() {
- assert.response(
- app,
- { url: '/user.json' },
- function(res) {
- res.statusCode.should.equal(200);
- res.headers.should.have.property('last-modified');
- assert.response(
- app,
- {
- url: '/user.json',
- headers: {
- 'If-Modified-Since': res.headers['last-modified']
- }
- },
- function(res) {
- res.statusCode.should.equal(304);
- res.headers.should.have.property('date');
- res.headers.should.have.property('last-modified');
- res.headers.should.have.property('etag');
- }
- );
- }
- );
- },
-
- 'old if-modified-since request': function() {
- assert.response(
- app2,
- { url: '/user.json' },
- function(res) {
- res.statusCode.should.equal(200);
- res.headers.should.have.property('last-modified');
- res.headers.should.have.property('etag');
- assert.response(
- app2,
- {
- url: '/user.json',
- headers: {
- 'If-Modified-Since': 'Sat, 29 Oct 1994 19:43:31 GMT'
- }
- },
- function(res) {
- res.statusCode.should.equal(200);
- res.headers.should.have.property('date');
- res.headers.should.have.property('last-modified');
- res.headers.should.have.property('etag');
- }
- );
- }
- );
- },
-
- 'no-cache request': function() {
- assert.response(
- app,
- { url: '/user.json' },
- function(res) {
- res.statusCode.should.equal(200);
- res.headers.should.have.property('etag');
- assert.response(
- app,
- {
- url: '/user.json',
- headers: {
- 'Cache-Control': 'no-cache, max-age=0',
- 'If-None-Match': res.headers.etag
- }
- },
- function(res) {
- res.statusCode.should.equal(304);
- // res.headers.should.have.property('date');
- res.headers.should.have.property('last-modified');
- res.headers.should.have.property('etag');
- }
- );
- }
- );
- },
-
- 'test range request': function(){
- assert.response(app,
- { url: '/list' },
- function(res) {
- assert.response(app,
- { url: '/list', headers: { Range: 'bytes=3-6' }},
- { body: '4567', 'Content-Range': 'bytes 3-6/9', status: 206 });
- });
- }
-};

0 comments on commit 2c93ba9

Please sign in to comment.