generated from Code-4-Community/frontend-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 3
reservation routes in protected api client #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
071cef7
reservation routes in protected api client
willmullinthomas 57b6c67
prettier
willmullinthomas ed09497
camelCase
willmullinthomas c3b7696
Merge branch 'master' into reservationRoutes
willmullinthomas 772dd44
I don't want to make this commit but git will nto let me discard changes
willmullinthomas b64e93f
merged with master
willmullinthomas 6829fa0
added slashes to routes and the first example test
willmullinthomas cdaa6dd
added reservation route tests
willmullinthomas 2b3f6c8
fixed fail reservations qa test
willmullinthomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,135 @@ | ||
| import nock from 'nock'; | ||
| import ProtectedApiClient, { | ||
| ProtectedApiClientRoutes, | ||
| AdminApiClientRoutes, | ||
| } from '../protectedApiClient'; | ||
|
|
||
| const BASE_URL = 'http://localhost'; | ||
|
|
||
| // TODO: handle invalid cases | ||
|
|
||
| describe('Protected Client Tests', () => { | ||
| describe('makeReservation', () => { | ||
| it('makes the right request with team', async () => { | ||
| const response = ''; | ||
|
|
||
| nock(BASE_URL) | ||
| .post(ProtectedApiClientRoutes.MAKE_RESERVATION) | ||
| .reply(200, response); | ||
|
|
||
| const result = await ProtectedApiClient.makeReservation(1, 1); | ||
|
|
||
| expect(result).toEqual(response); | ||
| }); | ||
|
|
||
| it('makes the right request without team', async () => { | ||
| const response = ''; | ||
|
|
||
| nock(BASE_URL) | ||
| .post(ProtectedApiClientRoutes.MAKE_RESERVATION) | ||
| .reply(200, response); | ||
|
|
||
| const result = await ProtectedApiClient.makeReservation(1); | ||
|
|
||
| expect(result).toEqual(response); | ||
| }); | ||
| }); | ||
|
|
||
| describe('completeReservation', () => { | ||
| it('makes the right request with team', async () => { | ||
| const response = ''; | ||
|
|
||
| nock(BASE_URL) | ||
| .post(ProtectedApiClientRoutes.COMPLETE_RESERVATION) | ||
| .reply(200, response); | ||
|
|
||
| const result = await ProtectedApiClient.completeReservation(2, 2); | ||
|
|
||
| expect(result).toEqual(response); | ||
| }); | ||
|
|
||
| it('makes the right request without team', async () => { | ||
| const response = ''; | ||
|
|
||
| nock(BASE_URL) | ||
| .post(ProtectedApiClientRoutes.COMPLETE_RESERVATION) | ||
| .reply(200, response); | ||
|
|
||
| const result = await ProtectedApiClient.completeReservation(2); | ||
|
|
||
| expect(result).toEqual(response); | ||
| }); | ||
| }); | ||
|
|
||
| describe('releaseReservation', () => { | ||
| it('makes the right request', async () => { | ||
| const response = ''; | ||
|
|
||
| nock(BASE_URL) | ||
| .post(ProtectedApiClientRoutes.RELEASE_RESERVATION) | ||
| .reply(200, response); | ||
|
|
||
| const result = await ProtectedApiClient.releaseReservation(2); | ||
|
|
||
| expect(result).toEqual(response); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Admin Protected Client Routes', () => { | ||
| describe('uncompleteReservation', () => { | ||
| it('makes the right request', async () => { | ||
| const response = ''; | ||
|
|
||
| nock(BASE_URL) | ||
| .post(AdminApiClientRoutes.UNCOMPLETE_RESERVATION) | ||
| .reply(200, response); | ||
|
|
||
| const result = await ProtectedApiClient.uncompleteReservation(5); | ||
|
|
||
| expect(result).toEqual(response); | ||
| }); | ||
| }); | ||
|
|
||
| describe('markReservationForQa', () => { | ||
| it('makes the right request', async () => { | ||
| const response = ''; | ||
|
|
||
| nock(BASE_URL) | ||
| .post(AdminApiClientRoutes.MARK_RESERVATION_FOR_QA) | ||
| .reply(200, response); | ||
|
|
||
| const result = await ProtectedApiClient.markReservationForQa(6); | ||
|
|
||
| expect(result).toEqual(response); | ||
| }); | ||
| }); | ||
|
|
||
| describe('passReservationQa', () => { | ||
| it('makes the right request', async () => { | ||
| const response = ''; | ||
|
|
||
| nock(BASE_URL) | ||
| .post(AdminApiClientRoutes.PASS_RESERVATION_QA) | ||
| .reply(200, response); | ||
|
|
||
| const result = await ProtectedApiClient.passReservationQa(6); | ||
|
|
||
| expect(result).toEqual(response); | ||
| }); | ||
| }); | ||
|
|
||
| describe('failReservationQa', () => { | ||
| it('makes the right request', async () => { | ||
| const response = ''; | ||
|
|
||
| nock(BASE_URL) | ||
| .post(AdminApiClientRoutes.FAIL_RESERVATION_QA) | ||
| .reply(200, response); | ||
|
|
||
| const result = await ProtectedApiClient.failReservationQa(7); | ||
|
|
||
| expect(result).toEqual(response); | ||
| }); | ||
| }); | ||
| }); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a ticket for this on Monday on the bugs/tech debt section? Don't want this to get lost. Or finish it as part of this PR.