Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fixed failing tests, extended tests to cover monaco command

TzeYiingd54a156a9158
diff --git a/studio/components/interfaces/Settings/Logs/LogsQueryPanel.tsx b/studio/components/interfaces/Settings/Logs/LogsQueryPanel.tsx
index 8f4d6a1e93a..fcf4e3a3d99 100644
--- a/studio/components/interfaces/Settings/Logs/LogsQueryPanel.tsx
+++ b/studio/components/interfaces/Settings/Logs/LogsQueryPanel.tsx
@@ -18,12 +18,13 @@ import {
} from '.'
import DatePickers from './Logs.DatePickers'
import Link from 'next/link'
+import React from 'react'
interface Props {
templates?: LogTemplate[]
onSelectTemplate: (template: LogTemplate) => void
onSelectSource: (source: LogsTableName) => void
- onRun: () => void
+ onRun: (e: React.MouseEvent<HTMLButtonElement>) => void
onClear: () => void
onSave?: () => void
hasEditorValue: boolean
diff --git a/studio/pages/project/[ref]/logs-explorer/index.tsx b/studio/pages/project/[ref]/logs-explorer/index.tsx
index b62f1fd4a23..cb8978d5f24 100644
--- a/studio/pages/project/[ref]/logs-explorer/index.tsx
+++ b/studio/pages/project/[ref]/logs-explorer/index.tsx
@@ -74,9 +74,9 @@ export const LogsExplorerPage: NextPage = () => {
})
}
- const handleRun = (value?: string) => {
- const query = value || editorValue
- if (value) {
+ const handleRun = (value?: string | React.MouseEvent<HTMLButtonElement>) => {
+ const query = typeof value === 'string' ? (value || editorValue) : editorValue
+ if (value && typeof value === 'string') {
setEditorValue(value)
}
changeQuery(query)
diff --git a/studio/tests/pages/projects/logs-query.test.js b/studio/tests/pages/projects/logs-query.test.js
index a08cf7ba040..e0b8faa91da 100644
--- a/studio/tests/pages/projects/logs-query.test.js
+++ b/studio/tests/pages/projects/logs-query.test.js
@@ -154,8 +154,11 @@ test('custom sql querying', async () => {
// type new query
userEvent.type(editor, 'select \ncount(*) as my_count \nfrom edge_logs')
- // should trigger query
+ // run query by button
userEvent.click(await screen.findByText('Run'))
+
+ // run query by editor
+ userEvent.type(editor, '\nlimit 123{ctrl}{enter}')
await waitFor(
() => {
expect(get).toHaveBeenCalledWith(expect.stringContaining(encodeURI('\n')))
@@ -163,10 +166,12 @@ test('custom sql querying', async () => {
expect(get).toHaveBeenCalledWith(expect.stringContaining('select'))
expect(get).toHaveBeenCalledWith(expect.stringContaining('edge_logs'))
expect(get).not.toHaveBeenCalledWith(expect.stringContaining('where'))
+ expect(get).not.toHaveBeenCalledWith(expect.stringContaining(encodeURIComponent("limit 123")))
},
{ timeout: 1000 }
)
+
await screen.findByText(/my_count/) //column header
const rowValue = await screen.findByText(/12345/) // row value