@@ -25,4 +25,45 @@ describe("Configuration", () => {
2525
2626 expect ( projectDirUri ) . toEqual ( URI . file ( "/stub/subdirectory" ) ) ;
2727 } ) ;
28+
29+ test ( "getReleasePathOverride returns undefined when no releasePathOverride is configured" , ( ) => {
30+ const getConfigMock = jest . fn ( ) . mockReturnValue ( undefined ) ;
31+ const workspace = WorkspaceFixture . withUri ( URI . file ( "/stub" ) ) ;
32+ const releasePathOverride = Configuration . getReleasePathOverride (
33+ getConfigMock ,
34+ workspace ,
35+ ) ;
36+
37+ expect ( releasePathOverride ) . toBeUndefined ( ) ;
38+ } ) ;
39+
40+ test ( "getReleasePathOverride returns the path as configured when it is asolute" , ( ) => {
41+ const absolutePath = "/an/absolute/path" ;
42+ const getConfigMock = jest . fn ( ) . mockReturnValue ( absolutePath ) ;
43+ const workspace = WorkspaceFixture . withUri ( URI . file ( "/stub" ) ) ;
44+ const releasePathOverride = Configuration . getReleasePathOverride (
45+ getConfigMock ,
46+ workspace ,
47+ ) ;
48+
49+ expect ( releasePathOverride ) . toBe ( absolutePath ) ;
50+ } ) ;
51+
52+ test . each ( [
53+ [ "./a/relative/path" , "/my/workspace" , "/my/workspace/a/relative/path" ] ,
54+ [ "../a/relative/path" , "/my/workspace" , "/my/a/relative/path" ] ,
55+ [ "a/relative/path" , "/my/workspace" , "/my/workspace/a/relative/path" ] ,
56+ ] ) (
57+ "getReleasePathOverride returns the workspace path joined with the release path when it is relative (%s)" ,
58+ ( releasePath , workspacePath , expectedPath ) => {
59+ const getConfigMock = jest . fn ( ) . mockReturnValue ( releasePath ) ;
60+ const workspace = WorkspaceFixture . withUri ( URI . file ( workspacePath ) ) ;
61+ const releasePathOverride = Configuration . getReleasePathOverride (
62+ getConfigMock ,
63+ workspace ,
64+ ) ;
65+
66+ expect ( releasePathOverride ) . toBe ( expectedPath ) ;
67+ } ,
68+ ) ;
2869} ) ;
0 commit comments