chore: add tests for LogsPreviewer

This commit is contained in:
TzeYiing committed 2022-10-12 13:49:37 +08:00
1 parent e15dbd9fa1
commit 5edb78f6b4
1 file changed
+30
@@ -393,3 +393,33 @@ test('filters accept filterOverride', async () => {
expect(get).toHaveBeenCalledWith(expect.stringContaining('myvalue'))
})
})
describe.each(['FREE', 'PRO', 'ENTERPRISE'])(
'upgrade modal for %s',
(key) => {
beforeEach(() => {
useProjectSubscription.mockReturnValue({
subscription: {
tier: {
supabase_prod_id: `tier_${key.toLocaleLowerCase()}`,
key
},
},
})
})
test('based on query params', async () => {
const router = defaultRouterMock()
router.query = {
...router.query,
q: 'some_query',
its: dayjs().subtract(4, 'months').toISOString(),
ite: dayjs().toISOString(),
}
useRouter.mockReturnValue(router)
render(<LogsExplorerPage />)
await screen.findByText('Log retention') // assert modal title is present
})
}
)