-
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.
- Loading branch information
1 parent
408c4ae
commit f5c8206
Showing
5 changed files
with
153 additions
and
3 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
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 |
---|---|---|
|
@@ -112,7 +112,61 @@ it('can set a multiple preferences for the wait list request', async () => { | |
}); | ||
|
||
it('can create a new wait list request for a given client using only required attributes', async () => { | ||
// | ||
const resource = new WaitList(mockAxios); | ||
const attendee = new Attendee; | ||
const preference = new Preference; | ||
|
||
await resource | ||
.for( | ||
attendee.named('Jane', 'Doe').reachable({ email: '[email protected]' }) | ||
) | ||
.at(1) | ||
.seeking(2) | ||
.prefers( | ||
preference.next() | ||
) | ||
.add(); | ||
|
||
expect(mockAxios.post).toHaveBeenCalledTimes(1); | ||
expect(mockAxios.post).toHaveBeenCalledWith('requests', { | ||
data: { | ||
attributes: {}, | ||
relationships: { | ||
client: { | ||
data: { | ||
attributes: { | ||
email: '[email protected]', | ||
first_name: 'Jane', | ||
last_name: 'Doe', | ||
}, | ||
type: 'clients' | ||
} | ||
}, | ||
location: { | ||
data: { | ||
id: '1', | ||
type: 'locations', | ||
} | ||
}, | ||
preferences: { | ||
data: [{ | ||
attributes: { | ||
start: Preference.now(), | ||
type: Preference.NEXT_AVAILABLE, | ||
}, | ||
type: 'request-preferences' | ||
}] | ||
}, | ||
service: { | ||
data: { | ||
id: '2', | ||
type: 'services', | ||
} | ||
}, | ||
}, | ||
type: 'requests' | ||
} | ||
}); | ||
}); | ||
|
||
it('can create a new wait list request for a given client using all attributes', async () => { | ||
|
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 |
---|---|---|
|
@@ -36,4 +36,6 @@ export interface PreferenceModel extends Model { | |
next(): this; | ||
|
||
on(day: number): this; | ||
|
||
transform(): object; | ||
} |
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