Skip to content

Commit

Permalink
use parse as part of core
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenHalman committed Feb 12, 2025
1 parent 5175814 commit f049f3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions tests/UnconnectedElement.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as core from "../src";
import * as path from "path";

import { parse } from "../src/main/libs/ParseFlows";
import { ParsedFlow } from "../src/main/models/ParsedFlow";

import { UnconnectedElement } from "../src/main/rules/UnconnectedElement";
Expand All @@ -16,7 +15,7 @@ describe("UnconnectedElement", () => {
__dirname,
"./xmlfiles/Unconnected_Element.flow-meta.xml"
);
const parsed: ParsedFlow = (await parse([connectedElementTestFile])).pop() as ParsedFlow;
const parsed: ParsedFlow = (await core.parse([connectedElementTestFile])).pop() as ParsedFlow;
const ruleResult: core.RuleResult = unconnectedElementRule.execute(parsed.flow as core.Flow);
expect(ruleResult.occurs).toBe(true);
expect(ruleResult.details).not.toHaveLength(0);
Expand All @@ -30,7 +29,7 @@ describe("UnconnectedElement", () => {
__dirname,
"./xmlfiles/Unconnected_Element_Async.flow-meta.xml"
);
const parsed: ParsedFlow = (await parse([connectedElementTestFile])).pop() as ParsedFlow;
const parsed: ParsedFlow = (await core.parse([connectedElementTestFile])).pop() as ParsedFlow;
const ruleResult: core.RuleResult = unconnectedElementRule.execute(parsed.flow as core.Flow);
expect(ruleResult.occurs).toBe(true);
ruleResult.details.forEach((ruleDetail) => {
Expand Down
7 changes: 3 additions & 4 deletions tests/UnsafeRunningContext.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as core from "../src";
import * as path from "path";

import { parse } from "../src/main/libs/ParseFlows";
import { ParsedFlow } from "../src/main/models/ParsedFlow";

import { describe, it, expect } from "@jest/globals";
Expand All @@ -15,7 +14,7 @@ describe("UnsafeRunningContext", () => {
__dirname,
"./xmlfiles/Unsafe_Running_Context.flow-meta.xml"
);
const parsed: ParsedFlow = (await parse([unsafeContextTestFile])).pop() as ParsedFlow;
const parsed: ParsedFlow = (await core.parse([unsafeContextTestFile])).pop() as ParsedFlow;
const ruleResult: core.RuleResult = unsafeRunningContext.execute(parsed.flow as core.Flow);
expect(ruleResult.occurs).toBe(true);
expect(ruleResult.details).not.toHaveLength(0);
Expand All @@ -27,7 +26,7 @@ describe("UnsafeRunningContext", () => {
__dirname,
"./xmlfiles/Unsafe_Running_Context_WithSharing.flow-meta.xml"
);
const parsed: ParsedFlow = (await parse([unsafeContextTestFile])).pop() as ParsedFlow;
const parsed: ParsedFlow = (await core.parse([unsafeContextTestFile])).pop() as ParsedFlow;
const ruleResult: core.RuleResult = unsafeRunningContext.execute(parsed.flow as core.Flow);
expect(ruleResult.occurs).toBe(false);
expect(ruleResult.details).toHaveLength(0);
Expand All @@ -38,7 +37,7 @@ describe("UnsafeRunningContext", () => {
__dirname,
"./xmlfiles/Unsafe_Running_Context_Default.flow-meta.xml"
);
const parsed: ParsedFlow = (await parse([unsafeContextTestFile])).pop() as ParsedFlow;
const parsed: ParsedFlow = (await core.parse([unsafeContextTestFile])).pop() as ParsedFlow;
const ruleResult: core.RuleResult = unsafeRunningContext.execute(parsed.flow as core.Flow);
expect(ruleResult.occurs).toBe(false);
expect(ruleResult.details).toHaveLength(0);
Expand Down

0 comments on commit f049f3e

Please sign in to comment.