@@ -94,19 +94,25 @@ describe("OctoInstaller", () => {
9494
9595 test ( "Installs specific version" , async ( ) => {
9696 const output = await executeCommand ( ( ) => new Installer ( octopusUrl ) . run ( "8.0.0" ) ) ;
97- expect ( output ) . toContain ( "/8.0.0/OctopusTools." ) ;
98- expect ( output ) . toContain ( "/octo/8.0.0" ) ;
97+ assertions ( output , "8.0.0" ) ;
9998 } ) ;
10099
101100 test ( "Installs wildcard version" , async ( ) => {
102101 const output = await executeCommand ( ( ) => new Installer ( octopusUrl ) . run ( "7.*" ) ) ;
103- expect ( output ) . toContain ( "/7.4.1/OctopusTools." ) ;
104- expect ( output ) . toContain ( "/octo/7.4.1" ) ;
102+ assertions ( output , "7.4.1" ) ;
105103 } ) ;
106104
107105 test ( "Installs latest of latest" , async ( ) => {
108106 const output = await executeCommand ( ( ) => new Installer ( octopusUrl ) . run ( "*" ) ) ;
109- expect ( output ) . toContain ( "/8.2.0/OctopusTools." ) ;
110- expect ( output ) . toContain ( "/octo/8.2.0" ) ;
107+ assertions ( output , "8.2.0" ) ;
111108 } ) ;
109+
110+ function assertions ( output : string , version : string ) {
111+ expect ( output ) . toContain ( toPath ( [ version , "OctopusTools." ] ) ) ;
112+ expect ( output ) . toContain ( toPath ( [ "octo" , version ] ) ) ;
113+ }
114+
115+ function toPath ( parts : string [ ] ) {
116+ return `${ path . sep } ${ parts . join ( path . sep ) } ` ;
117+ }
112118} ) ;
0 commit comments