-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stop): Create or update stop (#18) (EN-1811)
* feat(stop): Create or update stop * Update MessageTemplate.js Changed comments to use humanized description of MessageTemplate * Update MessageTemplate.js Humanized another MessageTemplate in the comments
- Loading branch information
1 parent
7df822d
commit 2f72c79
Showing
6 changed files
with
135 additions
and
8 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 |
---|---|---|
|
@@ -46,3 +46,45 @@ describe('When retrieving a stop by ID', () => { | |
return stopsPromise; | ||
}); | ||
}); | ||
|
||
describe('When creating a stop', () => { | ||
const api = new Track({ autoRenew: false }); | ||
|
||
beforeEach(() => charlie.setUpSuccessfulMock(api.client)); | ||
beforeEach(() => mockStops.setUpSuccessfulMock(api.client)); | ||
beforeEach(() => fetchMock.catch(503)); | ||
afterEach(fetchMock.restore); | ||
|
||
it('should create a stop', () => { | ||
api.logIn({ username: '[email protected]', password: 'securepassword' }); | ||
|
||
const stopPromise = api.customer('SYNC').stop({ name: '1st and Main' }) | ||
.create() | ||
.then(stop => stop); // Do things with stop | ||
|
||
return stopPromise; | ||
}); | ||
}); | ||
|
||
describe('When updating a stop', () => { | ||
const api = new Track({ autoRenew: false }); | ||
|
||
beforeEach(() => charlie.setUpSuccessfulMock(api.client)); | ||
beforeEach(() => mockStops.setUpSuccessfulMock(api.client)); | ||
beforeEach(() => fetchMock.catch(503)); | ||
afterEach(fetchMock.restore); | ||
|
||
it('should update a stop', () => { | ||
api.logIn({ username: '[email protected]', password: 'securepassword' }); | ||
|
||
const stopPromise = api.customer('SYNC').stop(1) | ||
.fetch() | ||
.then((stop) => { | ||
// eslint-disable-next-line no-param-reassign | ||
stop.name = 'First and Main'; | ||
return stop.update(); | ||
}); | ||
|
||
return stopPromise; | ||
}); | ||
}); |
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
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