Fix tests

Signed-off-by: shmaram <shaharshmaram@gmail.com>
This commit is contained in:
shmaram
2023-12-22 14:02:26 +02:00
parent 5812f27ad6
commit 891fcd5482
2 changed files with 42 additions and 1 deletions
@@ -250,7 +250,7 @@ describe('VisitsStorageApi.create', () => {
]);
});
it('filters by timestamp with >', async () => {
it('filters by timestamp with value >', async () => {
const visits = await api.list({
filterBy: [{ field: 'timestamp', operator: '>', value: baseDate }],
});
@@ -197,6 +197,47 @@ describe('<Content kind="recent"/>', () => {
});
});
});
it('allows recent items to have no filter if the filter config is not valid', async () => {
const configApiMock = new MockConfigApi({
home: {
recentVisits: {
filterBy: [
{
operator: '==',
value: '/tech-radar',
},
],
},
},
});
const listSpy = jest.spyOn(mockVisitsApi, 'list');
await renderInTestApp(
<TestApiProvider
apis={[
[configApiRef, configApiMock],
[visitsApiRef, mockVisitsApi],
]}
>
<ContextProvider>
<Content kind="recent" />
</ContextProvider>
</TestApiProvider>,
);
await waitFor(() => {
expect(listSpy).toHaveBeenCalledWith({
limit: 8,
orderBy: [
{
direction: 'desc',
field: 'timestamp',
},
],
});
});
});
});
describe('<Content kind="top"/>', () => {