Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: AI-commands tests with pnpm #31250

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
FIx the tests.
  • Loading branch information
ivasilov committed Dec 20, 2024
commit 0632decb84dbb53016134b7662b71c8b2b65c049
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`debug fix order of operations 1`] = `
exports[`debug > fix order of operations 1`] = `
"create table departments (
id bigint primary key generated always as identity,
name text
Expand All @@ -14,7 +14,7 @@ create table employees (
);"
`;

exports[`debug fix typos 1`] = `
exports[`debug > fix typos 1`] = `
"select
*
from
Expand Down
7 changes: 4 additions & 3 deletions packages/ai-commands/src/sql/functions.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { describe, expect, test } from '@jest/globals'
import { codeBlock } from 'common-tags'
import OpenAI from 'openai'
import { describe, expect, test } from 'vitest'

import { formatSql } from '../../test/util'
import { debugSql, titleSql } from './functions'

const openAiKey = process.env.OPENAI_API_KEY
const openai = new OpenAI({ apiKey: openAiKey })

describe('debug', () => {
test.concurrent('fix order of operations', async () => {
test.concurrent('fix order of operations', async ({ expect }) => {
const { sql } = await debugSql(
openai,
'relation "departments" does not exist',
Expand All @@ -30,7 +31,7 @@ describe('debug', () => {
expect(formatSql(sql)).toMatchSnapshot()
})

test.concurrent('fix typos', async () => {
test.concurrent('fix typos', async ({ expect }) => {
const { sql, solution } = await debugSql(
openai,
'syntax error at or near "fromm"',
Expand Down
3 changes: 2 additions & 1 deletion packages/ai-commands/src/sql/rls.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, expect, test } from '@jest/globals'
import { codeBlock } from 'common-tags'
import OpenAI from 'openai'
import { describe, expect, test } from 'vitest'

import {
assertAndRenderColumn,
assertAndUnwrapNode,
Expand Down
Loading