Skip to content

Commit

Permalink
Tries to avoid duplication of some test data
Browse files Browse the repository at this point in the history
  • Loading branch information
ncordon committed Jan 4, 2024
1 parent a343967 commit f47df26
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 8,962 deletions.
1 change: 1 addition & 0 deletions packages/language-support/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export { validateSyntax } from './highlighting/syntaxValidation/syntaxValidation
export { CypherTokenType, lexerSymbols } from './lexerSymbols';
export { parse, parserWrapper } from './parserWrapper';
export { signatureHelp } from './signatureHelp';
export { testData } from './tests/testData';
export { CypherLexer };
export { CypherParser };

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const mockSchema = {
const mockSchema = {
functionSignatures: {
abs: {
label: 'abs',
Expand Down Expand Up @@ -8920,7 +8920,7 @@ export const mockSchema = {
aliasNames: ['alias2', 'testalias'],
};

export const largeQuery = `
const largeQuery = `
CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
CREATE (Carrie:Person {name:'Carrie-Anne Moss', born:1967})
Expand Down Expand Up @@ -9429,3 +9429,8 @@ CREATE
WITH TomH as a
MATCH (a)-[:ACTED_IN]->(m)<-[:DIRECTED]-(d) RETURN a,m,d LIMIT 10;`;

export const testData = {
mockSchema,
largeQuery,
};
7 changes: 3 additions & 4 deletions packages/react-codemirror-playground/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { DbSchema } from '@neo4j-cypher/language-support';
import { DbSchema, testData } from '@neo4j-cypher/language-support';
import { CypherEditor } from '@neo4j-cypher/react-codemirror';
import { useMemo, useState } from 'react';
import { Tree } from 'react-d3-tree';
import { dummyDbSchema } from './mock-schema.js';
import { TokenTable } from './TokenTable';
import { getDebugTree } from './tree-util';

Expand Down Expand Up @@ -41,9 +40,9 @@ export function App() {
const [commandRanCount, setCommandRanCount] = useState(0);
const [darkMode, setDarkMode] = useState(false);

const [schema, setSchema] = useState<DbSchema>(dummyDbSchema);
const [schema, setSchema] = useState<DbSchema>(testData.mockSchema);
const [schemaText, setSchemaText] = useState<string>(
JSON.stringify(dummyDbSchema, undefined, 2),
JSON.stringify(testData.mockSchema, undefined, 2),
);
const [schemaError, setSchemaError] = useState<string | null>(null);

Expand Down
Loading

0 comments on commit f47df26

Please sign in to comment.