Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions __fixtures__/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function mockCoreWithEmptyImpl() {
summary.write = jest.spyOn(core.summary, "write").mockImplementation(() => Promise.resolve(undefined) as any);

const mock = {
getBooleanInput: jest.spyOn(core, "getBooleanInput").mockImplementation(() => true),
info: jest.spyOn(core, "info").mockImplementation(() => {}),
error: jest.spyOn(core, "error").mockImplementation(() => {}),
debug: jest.spyOn(core, "debug").mockImplementation(() => {}),
Expand Down
25 changes: 18 additions & 7 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { jest } from "@jest/globals";
import { mockCoreWithEmptyImpl } from "../__fixtures__/core";
import { run } from "../src/main";
import * as ui5VersionCheck from "../src/lib/ui5-version-check";
import * as ui5VersionCheck from "ui5-version-check";
import * as utils from "../src/lib/utils";

describe("main.ts", () => {
Expand All @@ -28,9 +28,19 @@ describe("main.ts", () => {
jest.spyOn(utils, "getRepoPath").mockReturnValueOnce(__dirname);
jest.spyOn(utils, "getInputAsArray").mockReturnValueOnce(["sample-project/app/**/webapp"]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
jest.spyOn(ui5VersionCheck as any, "UI5VersionChecker").mockImplementation(() => ({
jest.spyOn(ui5VersionCheck as any, "UI5VersionCheck").mockImplementation(() => ({
run: jest.fn(),
printSummary: jest.fn()
updatedFiles: ["sample-project/app/admin/webapp/manifest.json"],
summary: [
<ui5VersionCheck.ManifestCheckSummary>{
relPath: "sample-project/app/admin/webapp/manifest.json",
oldVers: "1.55",
newVers: "1.135.*",
status: "ok",
statusIcon: "✅",
statusText: "Version has been successfully updated"
}
]
}));

await expect(run()).resolves.toBeUndefined();
Expand Down Expand Up @@ -62,9 +72,10 @@ describe("main.ts", () => {
jest.spyOn(utils, "getRepoPath").mockReturnValueOnce(__dirname);
jest.spyOn(utils, "getInputAsArray").mockReturnValueOnce(["sample-project/app/**/webapp"]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
jest.spyOn(ui5VersionCheck as any, "UI5VersionChecker").mockImplementation(() => ({
jest.spyOn(ui5VersionCheck as any, "UI5VersionCheck").mockImplementation(() => ({
run: jest.fn(),
printSummary: jest.fn(),
updatedFiles: [],
summary: [],
get hasErrors() {
return true;
}
Expand All @@ -81,9 +92,9 @@ describe("main.ts", () => {
jest.spyOn(utils, "getRepoPath").mockReturnValueOnce(__dirname);
jest.spyOn(utils, "getInputAsArray").mockReturnValueOnce(["sample-project/app/**/webapp"]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
jest.spyOn(ui5VersionCheck as any, "UI5VersionChecker").mockImplementation(() => ({
jest.spyOn(ui5VersionCheck as any, "UI5VersionCheck").mockImplementation(() => ({
run: () => Promise.reject(new Error("Version fetch failed!")),
printSummary: jest.fn(),
// printSummary: jest.fn(),
get hasErrors() {
return true;
}
Expand Down
112 changes: 0 additions & 112 deletions __tests__/manifest.test.ts

This file was deleted.

213 changes: 0 additions & 213 deletions __tests__/ui5-version-api.test.ts

This file was deleted.

Loading