Skip to content

Commit

Permalink
Adds ability to set a supported locale filter
Browse files Browse the repository at this point in the history
  • Loading branch information
coconutcraig committed Sep 2, 2019
1 parent d8bd45a commit 9316958
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/resources/time-slot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ it('will set timezone filter', async () => {
});
});

it('will set supported locales filter', async () => {
const resource = new TimeSlot(mockAxios);

const locales = ['en', 'es'];

expect(resource.supporting(locales)).toHaveProperty('filters', {
locales,
});
});

it('can string all filterable options together', async () => {
const resource = new TimeSlot(mockAxios);

Expand Down
9 changes: 9 additions & 0 deletions src/resources/time-slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface TimeSlotFilter {
services?: number | number[];
start?: string;
timezone?: string;
locales?: string[];
user?: number;
}

Expand All @@ -31,6 +32,8 @@ export interface TimeSlotResource extends Resource, ConditionalResource {
for(services: number | number[]): this;

in(timezone: string): this;

supporting(locales: string[]): this;
}

export default class TimeSlot extends Conditional implements TimeSlotResource {
Expand Down Expand Up @@ -93,4 +96,10 @@ export default class TimeSlot extends Conditional implements TimeSlotResource {

return this;
}

public supporting(locales: string[]): this {
this.filters.locales = locales;

return this;
}
}

0 comments on commit 9316958

Please sign in to comment.