-
-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for endpoint rate limits (#3426)
- Loading branch information
1 parent
41b250e
commit 2dcd3d8
Showing
17 changed files
with
648 additions
and
26 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
36 changes: 36 additions & 0 deletions
36
packages/core/test/unit/resources/ApplicationPlanLimits.ts
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,36 @@ | ||
import { RequestHelper } from '../../../src/infrastructure'; | ||
import { ApplicationPlanLimits } from '../../../src'; | ||
|
||
jest.mock( | ||
'../../../src/infrastructure/RequestHelper', | ||
() => require('../../__mocks__/RequestHelper').default, | ||
); | ||
|
||
let service: ApplicationPlanLimits; | ||
|
||
beforeEach(() => { | ||
service = new ApplicationPlanLimits({ | ||
requesterFn: jest.fn(), | ||
token: 'abcdefg', | ||
}); | ||
}); | ||
|
||
describe('ApplicationPlanLimits.show', () => { | ||
it('should request GET /application/plan_limits', async () => { | ||
await service.show(); | ||
|
||
expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'application/plan_limits', undefined); | ||
}); | ||
}); | ||
|
||
describe('ApplicationPlanLimits.edit', () => { | ||
it('should request PUT /application/plan_limits with a terms property', async () => { | ||
await service.edit('Plan name'); | ||
|
||
expect(RequestHelper.put()).toHaveBeenCalledWith(service, 'application/plan_limits', { | ||
searchParams: { | ||
planName: 'Plan name', | ||
}, | ||
}); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
packages/core/test/unit/resources/ApplicationStatistics.ts
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,24 @@ | ||
import { RequestHelper } from '../../../src/infrastructure'; | ||
import { ApplicationStatistics } from '../../../src'; | ||
|
||
jest.mock( | ||
'../../../src/infrastructure/RequestHelper', | ||
() => require('../../__mocks__/RequestHelper').default, | ||
); | ||
|
||
let service: ApplicationStatistics; | ||
|
||
beforeEach(() => { | ||
service = new ApplicationStatistics({ | ||
requesterFn: jest.fn(), | ||
token: 'abcdefg', | ||
}); | ||
}); | ||
|
||
describe('ApplicationStatistics.show', () => { | ||
it('should request GET /application/statistics', async () => { | ||
await service.show(); | ||
|
||
expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'application/statistics', undefined); | ||
}); | ||
}); |
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,44 @@ | ||
import { RequestHelper } from '../../../src/infrastructure'; | ||
import { Applications } from '../../../src'; | ||
|
||
jest.mock( | ||
'../../../src/infrastructure/RequestHelper', | ||
() => require('../../__mocks__/RequestHelper').default, | ||
); | ||
|
||
let service: Applications; | ||
|
||
beforeEach(() => { | ||
service = new Applications({ | ||
requesterFn: jest.fn(), | ||
token: 'abcdefg', | ||
}); | ||
}); | ||
|
||
describe('Applications.all', () => { | ||
it('should request GET /applications without options', async () => { | ||
await service.all(); | ||
|
||
expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'applications', undefined); | ||
}); | ||
}); | ||
|
||
describe('Applications.show', () => { | ||
it('should request GET /applications', async () => { | ||
await service.create('application', 'url', 'scope1'); | ||
|
||
expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'applications', { | ||
name: 'application', | ||
redirectUri: 'url', | ||
scopes: 'scope1', | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Applications.remove', () => { | ||
it('should request GET /applications/:id', async () => { | ||
await service.remove(12); | ||
|
||
expect(RequestHelper.get()).toHaveBeenCalledWith(service, 'applications/12', undefined); | ||
}); | ||
}); |
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
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
Oops, something went wrong.