Skip to content

Commit

Permalink
Add request for index
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubMatejka committed Nov 10, 2020
1 parent 1e624dd commit ca984e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export default class Storage {
uri: string,
data: object | null = null
): Promise<any> {
const url = `${this.baseUri}/v2/storage/${uri}`;
let url = `${this.baseUri}/v2/storage`;
if (uri) {
url += `/${uri}`;
}
const params = {
method,
url,
Expand All @@ -65,6 +68,10 @@ export default class Storage {
}
}

async index(): Promise<any> {
return this.request('get', '');
}

async verifyToken(): Promise<any> {
return this.request('get', 'tokens/verify');
}
Expand Down
5 changes: 5 additions & 0 deletions test/Storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ describe('Storage', () => {
expect(res, 'to be a', 'number');
expect(res, 'to be positive');
});

it('index', async () => {
const res = await expect(storage.index(), 'to be fulfilled');
expect(res, 'to have key', 'components');
});
});

0 comments on commit ca984e2

Please sign in to comment.