Misc
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by visionmedia · committed by visionmedia · parent 7b580b8 · Browse files · 4 files·+60 added−58 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+60 added−58 removed
- tests:+60 added−58 removed
Provenance
- Commit
448a6d6- Tree
7886943- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent
7b580b8
4 files changed+60 added−58 removed
modified:spec/spec.mime.js+14 added-12 removed
12345567678910111213141516171819910111213141516172021
use(Express.Mime)
describe 'Express' describe 'Mime' describe '.mime()' it 'should return media type of extensions passed' Express.utilities.mime('jpeg').should.eql 'image/jpeg' describe '.mime()' it 'should return media type of extensions passed' Express.utilities.mime('jpeg').should.eql 'image/jpeg' end
it 'should return application/octet-stream when invalid' Express.utilities.mime('foobar').should.eql 'application/octet-stream' end
it 'should parse extension of basename or path passed' Express.utilities.mime('images/profile.png').should.eql 'image/png' Express.utilities.mime('foo.bar.something-else.png').should.eql 'image/png' end end it 'should return application/octet-stream when invalid' Express.utilities.mime('foobar').should.eql 'application/octet-stream' end it 'should parse extension of basename or path passed' Express.utilities.mime('images/profile.png').should.eql 'image/png' Express.utilities.mime('foo.bar.something-else.png').should.eql 'image/png' end endendNo newline at end of fileNo newline at end of filemodified:spec/spec.mocks.js+43 added-45 removed
12345673456891011127815161718192021910221124252627282930121314151617183334353637381920212223242526272829303132333435363738394142434445464041424344454849505152535446474849505152535654555657
describe 'Express' describe 'Spec' describe 'Helpers' describe 'mockRequest()' it 'should return a mock request' mockRequest().method.should.eql 'GET' describe 'Mocks' describe 'mockRequest()' it 'should return a mock request' mockRequest().method.should.eql 'GET' end it 'should merge hash passed' mockRequest({ method : 'POST' }).method.should.eql 'POST' end end describe 'mockResponse()' it 'should return a mock response' mockResponse().status.should.eql 200 end it 'should merge hash passed' mockResponse({ status : 404 }).status.should.eql 404 it 'should merge hash passed' mockRequest({ method : 'POST' }).method.should.eql 'POST' end end describe 'get()' it 'should get route when available' get('users', function(){ 'User list' }) get('users').body.should.eql 'User list' get('other').status.should.eql 404 end end describe 'mockResponse()' it 'should return a mock response' mockResponse().status.should.eql 200 end describe 'post()' it 'should post route when available' post('users/delete', function(){ 'Users deleted' }) post('users/delete').body.should.eql 'Users deleted' post('other').status.should.eql 404 end it 'should merge hash passed' mockResponse({ status : 404 }).status.should.eql 404 end end describe 'get()' it 'should get route when available' get('users', function(){ 'User list' }) get('users').body.should.eql 'User list' get('other').status.should.eql 404 end end describe 'post()' it 'should post route when available' post('users/delete', function(){ 'Users deleted' }) post('users/delete').body.should.eql 'Users deleted' post('other').status.should.eql 404 end end
describe 'put()' it 'should put route when available' put('user/update', function(){ 'Updated' }) put('user/update').body.should.eql 'Updated' put('other').status.should.eql 404 end describe 'put()' it 'should put route when available' put('user/update', function(){ 'Updated' }) put('user/update').body.should.eql 'Updated' put('other').status.should.eql 404 end describe 'del()' it 'should delete route when available' del('user', function(){ 'Deleted' }) del('user').body.should.eql 'Deleted' del('other').status.should.eql 404 end end describe 'del()' it 'should delete route when available' del('user', function(){ 'Deleted' }) del('user').body.should.eql 'Deleted' del('other').status.should.eql 404 end end endendNo newline at end of fileNo newline at end of filemodified:spec/spec.node.js+2 added
26 unmodified lines272829303132333435363738394041424344455 unmodified lines26 unmodified linesload('lib/express.mocks.js')load('lib/express.mime.js')load('lib/express.cookie.js')load('lib/express.view.js')load('lib/express.session.js')
setTimeout(function(){ JSpec .exec('spec/spec.core.js') .exec('spec/spec.routing.js') .exec('spec/spec.mocks.js') .exec('spec/spec.modules.js') .exec('spec/spec.mime.js') .exec('spec/spec.cookie.js') .exec('spec/spec.session.js') .exec('spec/spec.view.js') setTimeout(function(){ JSpec.run({ formatter : JSpec.formatters.Terminal, failuresOnly : true }) setTimeout(function() {5 unmodified linesmodified:spec/spec.view.js+1 added-1 removed
1233456
describe 'Express' describe 'views' describe 'View' endendNo newline at end of fileNo newline at end of file