Skip to content

Commit

Permalink
Fixes feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ncordon committed Jan 26, 2025
1 parent f3b41a1 commit 5084993
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ import {
CompletionItemTag,
} from 'vscode-languageserver-types';
import { DbSchema } from '../../dbSchema';
import { _internalFeatureFlags } from '../../featureFlags';
import { testData } from '../testData';
import { testCompletions } from './completionAssertionHelpers';

describe('function invocations', () => {
beforeAll(() => {
_internalFeatureFlags.cypher25 = true;
});

afterAll(() => {
_internalFeatureFlags.cypher25 = false;
});

const dbSchema: DbSchema = testData.mockSchema;
const functions = dbSchema.functions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ import {
CompletionItemTag,
} from 'vscode-languageserver-types';
import { DbSchema } from '../../dbSchema';
import { _internalFeatureFlags } from '../../featureFlags';
import { testData } from '../testData';
import { testCompletions } from './completionAssertionHelpers';

describe('Procedures auto-completion', () => {
beforeAll(() => {
_internalFeatureFlags.cypher25 = true;
});

afterAll(() => {
_internalFeatureFlags.cypher25 = false;
});

const procedures = testData.mockSchema.procedures;

const dbSchema: DbSchema = {
Expand Down
17 changes: 17 additions & 0 deletions packages/language-support/src/tests/signatureHelp.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SignatureHelp } from 'vscode-languageserver-types';
import { DbSchema } from '../dbSchema';
import { _internalFeatureFlags } from '../featureFlags';
import {
emptyResult,
signatureHelp,
Expand All @@ -21,6 +22,14 @@ export function testSignatureHelp(
}

describe('Procedures signature help', () => {
beforeAll(() => {
_internalFeatureFlags.cypher25 = true;
});

afterAll(() => {
_internalFeatureFlags.cypher25 = false;
});

const dbSchema = testData.mockSchema;
const procedureName = 'apoc.do.when';
const procedure = dbSchema.procedures['cypher 5'][procedureName];
Expand Down Expand Up @@ -254,6 +263,14 @@ describe('Procedures signature help', () => {
});

describe('Functions signature help', () => {
beforeAll(() => {
_internalFeatureFlags.cypher25 = true;
});

afterAll(() => {
_internalFeatureFlags.cypher25 = false;
});

const dbSchema = testData.mockSchema;
const functionName = 'apoc.coll.combinations';
const fn = dbSchema.functions['cypher 5'][functionName];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { DiagnosticTag } from 'vscode-languageserver-types';
import { _internalFeatureFlags } from '../../featureFlags';
import { testData } from '../testData';
import { getDiagnosticsForQuery } from './helpers';

describe('Functions semantic validation spec', () => {
beforeAll(() => {
_internalFeatureFlags.cypher25 = true;
});

afterAll(() => {
_internalFeatureFlags.cypher25 = false;
});

test('Syntax validation warns on deprecated function when database can be contacted and deprecated by is not present', () => {
const query = `RETURN id()`;
expect(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { _internalFeatureFlags } from '../../featureFlags';
import { testData } from '../testData';
import { getDiagnosticsForQuery } from './helpers';

describe('Procedures semantic validation spec', () => {
beforeAll(() => {
_internalFeatureFlags.cypher25 = true;
});

afterAll(() => {
_internalFeatureFlags.cypher25 = false;
});

test('Syntax validation warns on deprecated procedure when database can be contacted', () => {
const query = `CALL db.create.setVectorProperty()`;
expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { testData } from '../testData';
import { getDiagnosticsForQuery } from './helpers';

describe('Semantic validation spec', () => {
beforeAll(() => {
_internalFeatureFlags.cypher25 = true;
});

afterAll(() => {
_internalFeatureFlags.cypher25 = false;
});

test('Semantic analysis is dependant on cypher version', () => {
const query1 = 'CYPHER 5 MATCH (n)-[r]->(m) SET r += m';
const diagnostics1 = getDiagnosticsForQuery({ query: query1 });
Expand Down

0 comments on commit 5084993

Please sign in to comment.