Skip to content

Commit

Permalink
fix: review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
marufrasully committed Apr 10, 2024
1 parent 447b3c3 commit c27a1b3
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions packages/xml-views-definition/test/unit/utils/file.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { pathExists, buildFileUri } from "../../../src/utils";
import { join } from "path";
import { URI } from "vscode-uri";
const getExpectedFileUri = (parts: string[]) =>
URI.file(join(__dirname, ...parts)).toString();

describe("file", () => {
describe("pathExists", () => {
Expand Down Expand Up @@ -28,9 +30,12 @@ describe("file", () => {
// arrange
const namespace = "sap.ui.demo.walkthrough";
const value = "sap.ui.demo.walkthrough.controller.App";
const expectedFileUri = URI.file(
join(__dirname, "..", "data", "controller", "App.controller.js")
).toString();
const expectedFileUri = getExpectedFileUri([
"..",
"data",
"controller",
"App.controller.js",
]);
// act
const result = await buildFileUri(
namespace,
Expand All @@ -45,9 +50,12 @@ describe("file", () => {
// arrange
const namespace = "sap.ui.demo.walkthrough";
const value = "sap.ui.demo.walkthrough.controller.AppHelper";
const expectedFileUri = URI.file(
join(__dirname, "..", "data", "controller", "AppHelper.js")
).toString();
const expectedFileUri = getExpectedFileUri([
"..",
"data",
"controller",
"AppHelper.js",
]);
// act
const result = await buildFileUri(
namespace,
Expand All @@ -63,9 +71,12 @@ describe("file", () => {
// arrange
const namespace = "sap.ui.demo.walkthrough";
const value = "sap.ui.demo.walkthrough.controller.Helper";
const expectedFileUri = URI.file(
join(__dirname, "..", "data", "controller", "Helper.controller.ts")
).toString();
const expectedFileUri = getExpectedFileUri([
"..",
"data",
"controller",
"Helper.controller.ts",
]);
// act
const result = await buildFileUri(
namespace,
Expand All @@ -80,9 +91,13 @@ describe("file", () => {
// arrange
const namespace = "sap.ui.demo.walkthrough";
const value = "sap.ui.demo.walkthrough.controller.Handler";
const expectedFileUri = URI.file(
join(__dirname, "..", "data", "controller", "Handler.ts")
).toString();
const expectedFileUri = getExpectedFileUri([
"..",
"data",
"controller",
"Handler.ts",
]);

// act
const result = await buildFileUri(
namespace,
Expand Down

0 comments on commit c27a1b3

Please sign in to comment.