Skip to content

Commit

Permalink
Add a test for content-type header
Browse files Browse the repository at this point in the history
  • Loading branch information
jinroh committed Feb 1, 2017
1 parent 00b86bc commit 29bf29c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/unit/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ describe('Files', function () {

it('should work for supported data types', async function () {
const date = new Date('2017-02-01T10:24:42.116Z')
const res1 = await cozy.files.create('somestringdata', { name: 'foo', dirID: '12345' })
const res1 = await cozy.files.create('somestringdata', { name: 'foo', dirID: '12345', contentType: 'text/html' })
const res2 = await cozy.files.create(new Uint8Array(10), { name: 'foo', dirID: '12345', lastModifiedDate: date })
const res3 = await cozy.files.create(new ArrayBuffer(10), { name: 'foo', dirID: '12345' })

const calls = mock.calls('UploadFile')
calls.should.have.length(3)
calls[0][1].headers['Content-Type'].should.equal('text/html')
calls[1][1].headers['Date'].should.equal(date.toISOString())
mock.lastUrl('UploadFile').should.equal('http://my.cozy.io/files/12345?Name=foo&Type=file')

Expand Down

0 comments on commit 29bf29c

Please sign in to comment.