Skip to content

Commit 662b643

Browse files
committed
Fixes feature flag
1 parent f3b41a1 commit 662b643

File tree

7 files changed

+63
-2
lines changed

7 files changed

+63
-2
lines changed

packages/language-support/src/tests/autocompletion/functionsCompletion.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@ import {
33
CompletionItemTag,
44
} from 'vscode-languageserver-types';
55
import { DbSchema } from '../../dbSchema';
6+
import { _internalFeatureFlags } from '../../featureFlags';
67
import { testData } from '../testData';
78
import { testCompletions } from './completionAssertionHelpers';
89

910
describe('function invocations', () => {
11+
beforeAll(() => {
12+
_internalFeatureFlags.cypher25 = true;
13+
});
14+
15+
afterAll(() => {
16+
_internalFeatureFlags.cypher25 = false;
17+
});
18+
1019
const dbSchema: DbSchema = testData.mockSchema;
1120
const functions = dbSchema.functions;
1221

packages/language-support/src/tests/autocompletion/procedureCompletion.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@ import {
33
CompletionItemTag,
44
} from 'vscode-languageserver-types';
55
import { DbSchema } from '../../dbSchema';
6+
import { _internalFeatureFlags } from '../../featureFlags';
67
import { testData } from '../testData';
78
import { testCompletions } from './completionAssertionHelpers';
89

910
describe('Procedures auto-completion', () => {
11+
beforeAll(() => {
12+
_internalFeatureFlags.cypher25 = true;
13+
});
14+
15+
afterAll(() => {
16+
_internalFeatureFlags.cypher25 = false;
17+
});
18+
1019
const procedures = testData.mockSchema.procedures;
1120

1221
const dbSchema: DbSchema = {

packages/language-support/src/tests/signatureHelp.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { SignatureHelp } from 'vscode-languageserver-types';
22
import { DbSchema } from '../dbSchema';
3+
import { _internalFeatureFlags } from '../featureFlags';
34
import {
45
emptyResult,
56
signatureHelp,
@@ -21,6 +22,14 @@ export function testSignatureHelp(
2122
}
2223

2324
describe('Procedures signature help', () => {
25+
beforeAll(() => {
26+
_internalFeatureFlags.cypher25 = true;
27+
});
28+
29+
afterAll(() => {
30+
_internalFeatureFlags.cypher25 = false;
31+
});
32+
2433
const dbSchema = testData.mockSchema;
2534
const procedureName = 'apoc.do.when';
2635
const procedure = dbSchema.procedures['cypher 5'][procedureName];
@@ -254,6 +263,14 @@ describe('Procedures signature help', () => {
254263
});
255264

256265
describe('Functions signature help', () => {
266+
beforeAll(() => {
267+
_internalFeatureFlags.cypher25 = true;
268+
});
269+
270+
afterAll(() => {
271+
_internalFeatureFlags.cypher25 = false;
272+
});
273+
257274
const dbSchema = testData.mockSchema;
258275
const functionName = 'apoc.coll.combinations';
259276
const fn = dbSchema.functions['cypher 5'][functionName];

packages/language-support/src/tests/syntaxValidation/functionsValidation.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
import { DiagnosticTag } from 'vscode-languageserver-types';
2+
import { _internalFeatureFlags } from '../../featureFlags';
23
import { testData } from '../testData';
34
import { getDiagnosticsForQuery } from './helpers';
45

56
describe('Functions semantic validation spec', () => {
7+
beforeAll(() => {
8+
_internalFeatureFlags.cypher25 = true;
9+
});
10+
11+
afterAll(() => {
12+
_internalFeatureFlags.cypher25 = false;
13+
});
14+
615
test('Syntax validation warns on deprecated function when database can be contacted and deprecated by is not present', () => {
716
const query = `RETURN id()`;
817
expect(

packages/language-support/src/tests/syntaxValidation/proceduresValidation.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1+
import { _internalFeatureFlags } from '../../featureFlags';
12
import { testData } from '../testData';
23
import { getDiagnosticsForQuery } from './helpers';
34

45
describe('Procedures semantic validation spec', () => {
6+
beforeAll(() => {
7+
_internalFeatureFlags.cypher25 = true;
8+
});
9+
10+
afterAll(() => {
11+
_internalFeatureFlags.cypher25 = false;
12+
});
13+
514
test('Syntax validation warns on deprecated procedure when database can be contacted', () => {
615
const query = `CALL db.create.setVectorProperty()`;
716
expect(

packages/language-support/src/tests/syntaxValidation/semanticValidation.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ import { testData } from '../testData';
33
import { getDiagnosticsForQuery } from './helpers';
44

55
describe('Semantic validation spec', () => {
6+
beforeAll(() => {
7+
_internalFeatureFlags.cypher25 = true;
8+
});
9+
10+
afterAll(() => {
11+
_internalFeatureFlags.cypher25 = false;
12+
});
13+
614
test('Semantic analysis is dependant on cypher version', () => {
715
const query1 = 'CYPHER 5 MATCH (n)-[r]->(m) SET r += m';
816
const diagnostics1 = getDiagnosticsForQuery({ query: query1 });

packages/react-codemirror/src/CypherEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ export class CypherEditor extends Component<
349349
newLineOnEnter,
350350
} = this.props;
351351

352-
if (featureFlags.cypher25) {
353-
_internalFeatureFlags.cypher25 = featureFlags.cypher25;
352+
if (featureFlags?.cypher25) {
353+
_internalFeatureFlags.cypher25 = true;
354354
}
355355

356356
this.schemaRef.current = {

0 commit comments

Comments
 (0)