11import { jest } from "@jest/globals" ;
22import { mockCoreWithEmptyImpl } from "../__fixtures__/core" ;
33import { run } from "../src/main" ;
4- import * as ui5VersionCheck from "../src/lib/ ui5-version-check" ;
4+ import * as ui5VersionCheck from "ui5-version-check" ;
55import * as utils from "../src/lib/utils" ;
66
77describe ( "main.ts" , ( ) => {
@@ -28,9 +28,19 @@ describe("main.ts", () => {
2828 jest . spyOn ( utils , "getRepoPath" ) . mockReturnValueOnce ( __dirname ) ;
2929 jest . spyOn ( utils , "getInputAsArray" ) . mockReturnValueOnce ( [ "sample-project/app/**/webapp" ] ) ;
3030 // eslint-disable-next-line @typescript-eslint/no-explicit-any
31- jest . spyOn ( ui5VersionCheck as any , "UI5VersionChecker " ) . mockImplementation ( ( ) => ( {
31+ jest . spyOn ( ui5VersionCheck as any , "UI5VersionCheck " ) . mockImplementation ( ( ) => ( {
3232 run : jest . fn ( ) ,
33- printSummary : jest . fn ( )
33+ updatedFiles : [ "sample-project/app/admin/webapp/manifest.json" ] ,
34+ summary : [
35+ < ui5VersionCheck . ManifestCheckSummary > {
36+ relPath : "sample-project/app/admin/webapp/manifest.json" ,
37+ oldVers : "1.55" ,
38+ newVers : "1.135.*" ,
39+ status : "ok" ,
40+ statusIcon : "✅" ,
41+ statusText : "Version has been successfully updated"
42+ }
43+ ]
3444 } ) ) ;
3545
3646 await expect ( run ( ) ) . resolves . toBeUndefined ( ) ;
@@ -62,9 +72,10 @@ describe("main.ts", () => {
6272 jest . spyOn ( utils , "getRepoPath" ) . mockReturnValueOnce ( __dirname ) ;
6373 jest . spyOn ( utils , "getInputAsArray" ) . mockReturnValueOnce ( [ "sample-project/app/**/webapp" ] ) ;
6474 // eslint-disable-next-line @typescript-eslint/no-explicit-any
65- jest . spyOn ( ui5VersionCheck as any , "UI5VersionChecker " ) . mockImplementation ( ( ) => ( {
75+ jest . spyOn ( ui5VersionCheck as any , "UI5VersionCheck " ) . mockImplementation ( ( ) => ( {
6676 run : jest . fn ( ) ,
67- printSummary : jest . fn ( ) ,
77+ updatedFiles : [ ] ,
78+ summary : [ ] ,
6879 get hasErrors ( ) {
6980 return true ;
7081 }
@@ -81,9 +92,9 @@ describe("main.ts", () => {
8192 jest . spyOn ( utils , "getRepoPath" ) . mockReturnValueOnce ( __dirname ) ;
8293 jest . spyOn ( utils , "getInputAsArray" ) . mockReturnValueOnce ( [ "sample-project/app/**/webapp" ] ) ;
8394 // eslint-disable-next-line @typescript-eslint/no-explicit-any
84- jest . spyOn ( ui5VersionCheck as any , "UI5VersionChecker " ) . mockImplementation ( ( ) => ( {
95+ jest . spyOn ( ui5VersionCheck as any , "UI5VersionCheck " ) . mockImplementation ( ( ) => ( {
8596 run : ( ) => Promise . reject ( new Error ( "Version fetch failed!" ) ) ,
86- printSummary : jest . fn ( ) ,
97+ // printSummary: jest.fn(),
8798 get hasErrors ( ) {
8899 return true ;
89100 }
0 commit comments