Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion cli/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

// Configure Vitest (https://vitest.dev/config/)

import { defineConfig } from 'vitest/config';
import { configDefaults, defineConfig } from 'vitest/config';

export default defineConfig({
test: {
/* for example, use global to avoid globals imports (describe, test, expect): */
// globals: true,
restoreMocks: true,
exclude: [...configDefaults.exclude, 'dist/**'],
},
});
2 changes: 1 addition & 1 deletion client-tests/apollo-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"graphql-ws": "^6.0.6",
"ts-node": "^10.9.2",
"typescript": "^5.9.2",
"vitest": "^3.2.4"
"vitest": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion client-tests/mcp-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"@modelcontextprotocol/sdk": "^1.29.0",
"@types/node": "^22.19.15",
"typescript": "^5.9.3",
"vitest": "^3.2.4"
"vitest": "^5.0.0"
Comment thread
comatory marked this conversation as resolved.
}
}
2 changes: 1 addition & 1 deletion controlplane/test/delete-user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ vi.mock('../src/core/clickhouse/index.js', () => {
return { ClickHouseClient };
});

describe.sequential('Delete user tests', (ctx) => {
describe('Delete user tests', { concurrent: false }, () => {
let chClient: ClickHouseClient;

beforeEach(() => {
Expand Down
14 changes: 7 additions & 7 deletions controlplane/test/federated-graph/recompose.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import {
SetupTest,
} from '../test-util.js';

vi.mock('../../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

describe('federated-graph recompose tests', () => {
let chClient: ClickHouseClient;
let dbname = '';

vi.mock('../../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

beforeAll(async () => {
dbname = await beforeAllSetup();
});
Expand Down
14 changes: 7 additions & 7 deletions controlplane/test/federated-graph/version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ import {
SetupTest,
} from '../test-util.js';

vi.mock('../../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

describe('federated-graph version tests', () => {
let chClient: ClickHouseClient;
let dbname = '';

vi.mock('../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

beforeAll(async () => {
dbname = await beforeAllSetup();
});
Expand Down
14 changes: 7 additions & 7 deletions controlplane/test/monograph/recompose.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import { ClickHouseClient } from '../../src/core/clickhouse/index.js';
import { afterAllSetup, beforeAllSetup, genID } from '../../src/core/test-util.js';
import { assertNumberOfCompositions, createNamespace, SetupTest } from '../test-util.js';

vi.mock('../../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

describe('monograph recompose tests', () => {
let chClient: ClickHouseClient;
let dbname = '';

vi.mock('../../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

beforeAll(async () => {
dbname = await beforeAllSetup();
});
Expand Down
14 changes: 7 additions & 7 deletions controlplane/test/monograph/version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ import {
} from '../../src/core/test-util.js';
import { assertNumberOfCompositions, createNamespace, SetupTest } from '../test-util.js';

vi.mock('../../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

describe('monograph version tests', () => {
let chClient: ClickHouseClient;
let dbname = '';

vi.mock('../../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

beforeAll(async () => {
dbname = await beforeAllSetup();
});
Expand Down
68 changes: 28 additions & 40 deletions controlplane/test/openai-graphql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,34 @@ import { describe, expect, test } from 'vitest';
import { OpenAIGraphql } from '../src/core/openai-graphql/index.js';

describe('OpenAI GraphQL', () => {
test(
'Should properly correct schema',
async () => {
if (!process.env.OPENAI_API_KEY) {
return;
}
const ai = new OpenAIGraphql({
openAiApiKey: process.env.OPENAI_API_KEY,
});
const result = await ai.fixSDL({
sdl: brokenSubgraphSDL,
checkResult: brokenSubgraphCheckResult,
});
expect(result.sdl).toEqual(fixedSubgraphSDL);
},
{
timeout: 20_000,
},
);

test(
'Should properly generate a README from a GraphQL schema',
async () => {
if (!process.env.OPENAI_API_KEY) {
return;
}
const ai = new OpenAIGraphql({
openAiApiKey: process.env.OPENAI_API_KEY,
});
const result = await ai.generateReadme({
sdl: schemaSDL,
graphName: 'MyGraph',
});

expect(result.readme).toBeDefined();
},
{
timeout: 20_000,
},
);
test('Should properly correct schema', { timeout: 20_000 }, async () => {
if (!process.env.OPENAI_API_KEY) {
return;
}
const ai = new OpenAIGraphql({
openAiApiKey: process.env.OPENAI_API_KEY,
});
const result = await ai.fixSDL({
sdl: brokenSubgraphSDL,
checkResult: brokenSubgraphCheckResult,
});
expect(result.sdl).toEqual(fixedSubgraphSDL);
});

test('Should properly generate a README from a GraphQL schema', { timeout: 20_000 }, async () => {
if (!process.env.OPENAI_API_KEY) {
return;
}
const ai = new OpenAIGraphql({
openAiApiKey: process.env.OPENAI_API_KEY,
});
const result = await ai.generateReadme({
sdl: schemaSDL,
graphName: 'MyGraph',
});

expect(result.readme).toBeDefined();
});
});

const brokenSubgraphCheckResult = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { SetupTest } from '../test-util.js';
import { afterAllSetup, beforeAllSetup } from '../../src/core/test-util.js';
import { ClickHouseClient } from '../../src/core/clickhouse/index.js';

vi.mock('../../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

describe('GetOrganizationBySlug', () => {
let chClient: ClickHouseClient;
let dbname = '';

vi.mock('../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

beforeAll(async () => {
dbname = await beforeAllSetup();
});
Expand Down
14 changes: 7 additions & 7 deletions controlplane/test/router/compatibility-version/list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { SetupTest } from '../../test-util.js';
import { afterAllSetup, beforeAllSetup } from '../../../src/core/test-util.js';
import { ClickHouseClient } from '../../../src/core/clickhouse/index.js';

vi.mock('../../../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

describe('router compatibility-version list tests', () => {
let chClient: ClickHouseClient;
let dbname = '';

vi.mock('../src/core/clickhouse/index.js', () => {
const ClickHouseClient = vi.fn();
ClickHouseClient.prototype.queryPromise = vi.fn();

return { ClickHouseClient };
});

beforeAll(async () => {
dbname = await beforeAllSetup();
});
Expand Down
4 changes: 2 additions & 2 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@
"@types/prismjs": "^1.26.3",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"@vitejs/plugin-react": "^5.2.0",
"autoprefixer": "^10.4.16",
"postcss": "catalog:",
"tailwind-merge": "^2.0.0",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss": "^3.4.15",
"tailwindcss-animate": "^1.0.7",
"typescript": "catalog:",
"vite": "^5.4.21",
"vite": "^6.4.3",
"vite-plugin-dts": "4.5.4",
"vite-plugin-html": "^3.2.2",
"vite-plugin-singlefile": "^2.2.0"
Expand Down
Loading
Loading