Skip to content
Myr

tests: add some res.sendfile directory tests

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 3de4e42 · Browse files · 1 file+23 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+23 added−3 removed

  • tests:+23 added−3 removed

1 file+23 added−3 removed

modified:test/res.sendFile.js+23 added-3 removed
31 unmodified lines
32 .get('/')33 .expect(200, '20%', done);34 });3536 it('should 404 for directory', function (done) {37 var app = createApp(path.resolve(fixtures, 'blog'));3839 request(app)40 .get('/')41 .expect(404, done);42 });4344 it('should 404 when not found', function (done) {45 var app = createApp(path.resolve(fixtures, 'does-no-exist'));4647 app.use(function (req, res) {
123 unmodified lines
171172 describe('.sendfile(path, fn)', function(){173 it('should invoke the callback when complete', function(done){174 var app = express();175 var cb = after(2, done);176177 app.use(function(req, res){169 res.sendfile('test/fixtures/user.html', done)178 res.sendfile('test/fixtures/user.html', cb)179 });180181 request(app)182 .get('/')174 .expect(200)175 .end(function(){});183 .expect(200, cb);184 })185186 it('should utilize the same options as express.static()', function(done){187 var app = express();
165 unmodified lines
353 .get('/')354 .expect(200, '<b>index</b>', done);355 });356357 it('should 404 for directory without trailing slash', function (done) {358 var app = express();359360 app.use(function (req, res) {361 res.sendfile('test/fixtures/blog');362 });363364 request(app)365 .get('/')366 .expect(404, done);367 });368369 it('should transfer a file with urlencoded name', function (done) {370 var app = express();371372 app.use(function (req, res) {
148 unmodified lines