Skip to content

Commit

Permalink
Adapt tests to changes
Browse files Browse the repository at this point in the history
  • Loading branch information
georg-schwarz committed Nov 2, 2023
1 parent b5bddfd commit 25a5cca
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
15 changes: 10 additions & 5 deletions libs/interpreter-lib/src/parsing-util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import { CachedLogger } from '@jvalue/jayvee-execution';
import {
JayveeServices,
createJayveeServices,
useExtension,
initializeWorkspace,
} from '@jvalue/jayvee-language-server';
import {
ParseHelperOptions,
TestLangExtension,
expectNoParserAndLexerErrors,
parseHelper,
readJvTestAssetHelper,
Expand All @@ -39,7 +38,7 @@ describe('Validation of parsing-util', () => {
'../test/assets/parsing-util/',
);

beforeAll(() => {
beforeAll(async () => {
// Mock Process.exit
exitSpy = jest
.spyOn(process, 'exit')
Expand All @@ -50,10 +49,16 @@ describe('Validation of parsing-util', () => {
throw new Error(`process.exit: ${code}`);
});

// Register test extension
useExtension(new TestLangExtension());
// Create language services
services = createJayveeServices(NodeFileSystem).Jayvee;

await initializeWorkspace(services, [
{
uri: process.cwd(),
name: 'TestBlockTypes.jv',
},
]);

// Parse function for Jayvee (without validation)
parse = parseHelper(services);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import {
RuntimeParameterProvider,
ValidationContext,
createJayveeServices,
useExtension,
initializeWorkspace,
} from '@jvalue/jayvee-language-server';
import {
ParseHelperOptions,
TestLangExtension,
expectNoParserAndLexerErrors,
parseHelper,
readJvTestAssetHelper,
Expand Down Expand Up @@ -66,12 +65,18 @@ describe('Validation of validateRuntimeParameterLiteral', () => {
);
}

beforeAll(() => {
// Register test extension
useExtension(new TestLangExtension());
beforeAll(async () => {
// Create language services
const services = createJayveeServices(NodeFileSystem).Jayvee;

await initializeWorkspace(services, [
{
uri: process.cwd(),
name: 'TestBlockTypes.jv',
},
]);
locator = services.workspace.AstNodeLocator;

// Parse function for Jayvee (without validation)
parse = parseHelper(services);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
builtin blocktype TestFileExtractor {
input inPort oftype None;
output outPort oftype File;
}

builtin blocktype TestFileLoader {
input inPort oftype File;
output outPort oftype None;
}

builtin blocktype TestTableLoader {
input inPort oftype Table;
output outPort oftype None;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export class JayveeWorkspaceManager extends DefaultWorkspaceManager {
*/
export async function initializeWorkspace(
services: LangiumServices,
workspaceFolders: WorkspaceFolder[] = [],
): Promise<void> {
const workspaceFolders: WorkspaceFolder[] = [];
await services.shared.workspace.WorkspaceManager.initializeWorkspace(
workspaceFolders,
);
Expand Down

0 comments on commit 25a5cca

Please sign in to comment.