The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Refactor failing ApiReport test to use waitFor instead of just await -> findBy
Brandon Scott291d4c5c6d32
diff --git a/studio/tests/pages/projects/logs-query.test.js b/studio/tests/pages/projects/logs-query.test.jsindex 7fd180206d9..7ba7feb3aac 100644--- a/studio/tests/pages/projects/logs-query.test.js+++ b/studio/tests/pages/projects/logs-query.test.js@@ -2,7 +2,7 @@ import { get } from 'lib/common/fetch'import { useRouter } from 'next/router'import { LogsExplorerPage } from 'pages/project/[ref]/logs/explorer/index'import { render } from 'tests/helpers'-import { waitFor, screen } from '@testing-library/react'+import { waitFor, screen, fireEvent } from '@testing-library/react'import userEvent from '@testing-library/user-event'import { logDataFixture } from '../../fixtures'import { clickDropdown } from 'tests/helpers'@@ -131,7 +131,10 @@ test('custom sql querying', async () => {expect(get).toHaveBeenCalledWith(expect.stringContaining('sql='), expect.anything())expect(get).toHaveBeenCalledWith(expect.stringContaining('select'), expect.anything())expect(get).toHaveBeenCalledWith(expect.stringContaining('edge_logs'), expect.anything())- expect(get).toHaveBeenCalledWith(expect.stringContaining(encodeURIComponent("my_count")), expect.anything())+ expect(get).toHaveBeenCalledWith(+ expect.stringContaining(encodeURIComponent('my_count')),+ expect.anything()+ )expect(get).toHaveBeenCalledWith(expect.stringContaining('iso_timestamp_start'),expect.anything()@@ -160,11 +163,11 @@ test('custom sql querying', async () => {await expect(screen.findByText(/Load older/)).rejects.toThrow()})-test("bug: can edit query after selecting a log", async ()=>{+test('bug: can edit query after selecting a log', async () => {get.mockImplementation((url) => {- if (url.includes('sql=') && url.includes('select') && !url.includes("limit 222")) {+ if (url.includes('sql=') && url.includes('select') && !url.includes('limit 222')) {return {- result: [ { my_count: 12345 }],+ result: [{ my_count: 12345 }],}}return { result: [] }@@ -186,7 +189,10 @@ test("bug: can edit query after selecting a log", async ()=>{await waitFor(() => {- expect(get).toHaveBeenCalledWith(expect.stringContaining(encodeURIComponent("something")), expect.anything())+ expect(get).toHaveBeenCalledWith(+ expect.stringContaining(encodeURIComponent('something')),+ expect.anything()+ )},{ timeout: 1000 })@@ -241,9 +247,12 @@ describe.each(['FREE', 'PRO', 'TEAM', 'ENTERPRISE'])('upgrade modal for %s', (ketest('based on datepicker helpers', async () => {render(<LogsExplorerPage />)- // click on the dropdown- clickDropdown(await screen.findByText('Last 24 hours'))- userEvent.click(await screen.findByText('Last 3 days'))++ clickDropdown(screen.getByText('Last 24 hours'))+ await waitFor(async () => {+ const option = await screen.findByText('Last 3 days')+ fireEvent.click(option)+ })// only free tier will show modalif (key === 'FREE') {