@@ -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"/>', () => {
|
||||
|
||||
Reference in New Issue
Block a user