Skip to content

Commit 2679365

Browse files
authored
Merge pull request #25 from tainguyenbui/master
Apply latest changes
2 parents ee1d07b + 118c59a commit 2679365

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-dataverse",
3-
"version": "1.0.39",
3+
"version": "1.0.41",
44
"description": "A Dataverse module for JavaScript/TypeScript",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/dataverseClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class DataverseClient {
5858
})
5959
}
6060

61-
public async getFile(fileId: string, getOriginal = true): Promise<AxiosResponse> {
61+
public async getFile(fileId: string, getOriginal = false): Promise<AxiosResponse> {
6262
const url = `${this.host}/api/access/datafile/${fileId}${getOriginal ? '?format=original' : ''}`
6363
return this.getRequest(url, {
6464
headers: this.getHeaders(),

test/dataverseClient.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,20 +434,20 @@ describe('DataverseClient', () => {
434434
await client.getFile(fileId)
435435

436436
assert.calledOnce(axiosGetStub)
437-
assert.calledWithExactly(axiosGetStub, `${host}/api/access/datafile/${fileId}?format=original`, {
437+
assert.calledWithExactly(axiosGetStub, `${host}/api/access/datafile/${fileId}`, {
438438
headers: { 'X-Dataverse-key': apiToken },
439439
responseType: 'arraybuffer'
440440
})
441441
})
442442

443-
describe('get ingested file', () => {
443+
describe('get original file', () => {
444444
it('should call axios with expected url', async () => {
445445
const fileId: string = random.number().toString()
446446

447-
await client.getFile(fileId, false)
447+
await client.getFile(fileId, true)
448448

449449
assert.calledOnce(axiosGetStub)
450-
assert.calledWithExactly(axiosGetStub, `${host}/api/access/datafile/${fileId}`, {
450+
assert.calledWithExactly(axiosGetStub, `${host}/api/access/datafile/${fileId}?format=original`, {
451451
headers: { 'X-Dataverse-key': apiToken },
452452
responseType: 'arraybuffer'
453453
})
@@ -461,7 +461,7 @@ describe('DataverseClient', () => {
461461
await client.getFile(fileId)
462462

463463
assert.calledOnce(axiosGetStub)
464-
assert.calledWithExactly(axiosGetStub, `${host}/api/access/datafile/${fileId}?format=original`, {
464+
assert.calledWithExactly(axiosGetStub, `${host}/api/access/datafile/${fileId}`, {
465465
headers: { 'X-Dataverse-key': '' },
466466
responseType: 'arraybuffer'
467467
})
@@ -475,7 +475,7 @@ describe('DataverseClient', () => {
475475
'test': randomValue
476476
}
477477
axiosGetStub
478-
.withArgs(`${host}/api/access/datafile/${fileId}?format=original`, {
478+
.withArgs(`${host}/api/access/datafile/${fileId}`, {
479479
headers: { 'X-Dataverse-key': apiToken },
480480
responseType: 'arraybuffer'
481481
})

0 commit comments

Comments
 (0)