-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds open api options and new tests for base class and client
- Loading branch information
1 parent
b10d60f
commit 6a78c56
Showing
6 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export default { | ||
create: jest.fn(() => Promise.resolve({})), | ||
get: jest.fn(() => Promise.resolve({ data: {} })), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import mockAxios from 'axios'; | ||
|
||
import Client from './client'; | ||
|
||
it('will be constructed using passed in options', async () => { | ||
Client({ domain: 'admin', version: 'v2' }); | ||
|
||
expect(mockAxios.create).toHaveBeenCalledWith({ | ||
baseURL: `https://admin.coconutcalendar.com/api/v2/open`, | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
'X-Requested-With': 'XMLHttpRequest', | ||
}, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import OpenApi from './index'; | ||
|
||
it('will be constructed with appropriate options', async () => { | ||
const instance = new OpenApi({ | ||
domain: 'admin', | ||
}); | ||
|
||
expect(instance).toHaveProperty('options', { | ||
domain: 'admin', | ||
version: 'v2', | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface OpenApiOptions { | ||
domain: string; | ||
version?: string; | ||
} |