Add test for new functionality

Signed-off-by: Sarah Medeiros <smedeiros@wayfair.com>
This commit is contained in:
Sarah Medeiros
2022-12-09 14:57:00 -05:00
parent 5be74dcb59
commit 7a7073f75c
2 changed files with 34 additions and 1 deletions
@@ -184,7 +184,6 @@ describe('<EntityLifecyclePicker/>', () => {
updateFilters,
queryParameters: { lifecycles: ['production'] },
backendEntities: sampleEntities,
q,
}}
>
<EntityLifecyclePicker />
@@ -194,4 +193,21 @@ describe('<EntityLifecyclePicker/>', () => {
lifecycles: new EntityLifecycleFilter(['production']),
});
});
it('removes lifecycles from filters if there are no available lifecycles', () => {
const updateFilters = jest.fn();
render(
<MockEntityListContextProvider
value={{
updateFilters,
queryParameters: { lifecycles: ['experimental'] },
backendEntities: [],
}}
>
<EntityLifecyclePicker />
</MockEntityListContextProvider>,
);
expect(updateFilters).toHaveBeenLastCalledWith({
lifecycles: undefined,
});
});
});
@@ -207,4 +207,21 @@ describe('<EntityOwnerPicker/>', () => {
owners: new EntityOwnerFilter(['team-b']),
});
});
it('removes owners from filters if there are none available', () => {
const updateFilters = jest.fn();
render(
<MockEntityListContextProvider
value={{
updateFilters,
queryParameters: { owners: ['team-a'] },
backendEntities: [],
}}
>
<EntityOwnerPicker />
</MockEntityListContextProvider>,
);
expect(updateFilters).toHaveBeenLastCalledWith({
owners: undefined,
});
});
});