Skip to content

Commit 7926f21

Browse files
committed
add mimeLookup tests
1 parent 6b0d2d8 commit 7926f21

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

test/utils.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,50 @@ describe('Utility Function Tests:', function() {
8484
}) // end encodeBody tests
8585

8686

87+
describe('mimeLookup:', function() {
88+
89+
it('.pdf', function() {
90+
expect(utils.mimeLookup('.pdf')).to.equal('application/pdf')
91+
}) // end it
92+
93+
it('application/pdf', function() {
94+
expect(utils.mimeLookup('application/pdf')).to.equal('application/pdf')
95+
}) // end it
96+
97+
it('application-x/pdf (non-standard w/ slash)', function() {
98+
expect(utils.mimeLookup('application-x/pdf')).to.equal('application-x/pdf')
99+
}) // end it
100+
101+
it('xml', function() {
102+
expect(utils.mimeLookup('xml')).to.equal('application/xml')
103+
}) // end it
104+
105+
it('.html', function() {
106+
expect(utils.mimeLookup('.html')).to.equal('text/html')
107+
}) // end it
108+
109+
it('css', function() {
110+
expect(utils.mimeLookup('css')).to.equal('text/css')
111+
}) // end it
112+
113+
it('jpg', function() {
114+
expect(utils.mimeLookup('jpg')).to.equal('image/jpeg')
115+
}) // end it
116+
117+
it('.svg', function() {
118+
expect(utils.mimeLookup('.svg')).to.equal('image/svg+xml')
119+
}) // end it
120+
121+
it('docx', function() {
122+
expect(utils.mimeLookup('docx')).to.equal('application/vnd.openxmlformats-officedocument.wordprocessingml.document')
123+
}) // end it
124+
125+
it('Custom', function() {
126+
expect(utils.mimeLookup('.mpeg', { mpeg: 'video/mpeg' })).to.equal('video/mpeg')
127+
}) // end it
128+
129+
130+
}) // end encodeBody tests
131+
132+
87133
}) // end UTILITY tests

0 commit comments

Comments
 (0)