@@ -20,6 +20,7 @@ import {
2020 MockProgressReporter ,
2121 MockUserInteraction ,
2222} from "../../mocks/testHelpers" ;
23+ import { expectPathsEqual } from "../../utils/platform" ;
2324
2425vi . mock ( "os" ) ;
2526vi . mock ( "axios" ) ;
@@ -213,7 +214,7 @@ describe("CliManager", () => {
213214 it ( "accepts valid semver versions" , async ( ) => {
214215 withExistingBinary ( TEST_VERSION ) ;
215216 const result = await manager . fetchBinary ( mockApi , "test" ) ;
216- expect ( result ) . toBe ( BINARY_PATH ) ;
217+ expectPathsEqual ( result , BINARY_PATH ) ;
217218 } ) ;
218219 } ) ;
219220
@@ -226,7 +227,7 @@ describe("CliManager", () => {
226227 it ( "reuses matching binary without downloading" , async ( ) => {
227228 withExistingBinary ( TEST_VERSION ) ;
228229 const result = await manager . fetchBinary ( mockApi , "test" ) ;
229- expect ( result ) . toBe ( BINARY_PATH ) ;
230+ expectPathsEqual ( result , BINARY_PATH ) ;
230231 expect ( mockAxios . get ) . not . toHaveBeenCalled ( ) ;
231232 // Verify binary still exists
232233 expect ( memfs . existsSync ( BINARY_PATH ) ) . toBe ( true ) ;
@@ -236,7 +237,7 @@ describe("CliManager", () => {
236237 withExistingBinary ( "1.0.0" ) ;
237238 withSuccessfulDownload ( ) ;
238239 const result = await manager . fetchBinary ( mockApi , "test" ) ;
239- expect ( result ) . toBe ( BINARY_PATH ) ;
240+ expectPathsEqual ( result , BINARY_PATH ) ;
240241 expect ( mockAxios . get ) . toHaveBeenCalled ( ) ;
241242 // Verify new binary exists
242243 expect ( memfs . existsSync ( BINARY_PATH ) ) . toBe ( true ) ;
@@ -249,7 +250,7 @@ describe("CliManager", () => {
249250 mockConfig . set ( "coder.enableDownloads" , false ) ;
250251 withExistingBinary ( "1.0.0" ) ;
251252 const result = await manager . fetchBinary ( mockApi , "test" ) ;
252- expect ( result ) . toBe ( BINARY_PATH ) ;
253+ expectPathsEqual ( result , BINARY_PATH ) ;
253254 expect ( mockAxios . get ) . not . toHaveBeenCalled ( ) ;
254255 // Should still have the old version
255256 expect ( memfs . existsSync ( BINARY_PATH ) ) . toBe ( true ) ;
@@ -262,7 +263,7 @@ describe("CliManager", () => {
262263 withCorruptedBinary ( ) ;
263264 withSuccessfulDownload ( ) ;
264265 const result = await manager . fetchBinary ( mockApi , "test" ) ;
265- expect ( result ) . toBe ( BINARY_PATH ) ;
266+ expectPathsEqual ( result , BINARY_PATH ) ;
266267 expect ( mockAxios . get ) . toHaveBeenCalled ( ) ;
267268 expect ( memfs . existsSync ( BINARY_PATH ) ) . toBe ( true ) ;
268269 expect ( memfs . readFileSync ( BINARY_PATH ) . toString ( ) ) . toBe (
@@ -276,7 +277,7 @@ describe("CliManager", () => {
276277
277278 withSuccessfulDownload ( ) ;
278279 const result = await manager . fetchBinary ( mockApi , "test" ) ;
279- expect ( result ) . toBe ( BINARY_PATH ) ;
280+ expectPathsEqual ( result , BINARY_PATH ) ;
280281 expect ( mockAxios . get ) . toHaveBeenCalled ( ) ;
281282
282283 // Verify directory was created and binary exists
@@ -392,7 +393,7 @@ describe("CliManager", () => {
392393 withExistingBinary ( "1.0.0" ) ;
393394 withHttpResponse ( 304 ) ;
394395 const result = await manager . fetchBinary ( mockApi , "test" ) ;
395- expect ( result ) . toBe ( BINARY_PATH ) ;
396+ expectPathsEqual ( result , BINARY_PATH ) ;
396397 // No change
397398 expect ( memfs . readFileSync ( BINARY_PATH ) . toString ( ) ) . toBe (
398399 mockBinaryContent ( "1.0.0" ) ,
@@ -460,7 +461,7 @@ describe("CliManager", () => {
460461 it ( "handles missing content-length" , async ( ) => {
461462 withSuccessfulDownload ( { headers : { } } ) ;
462463 const result = await manager . fetchBinary ( mockApi , "test" ) ;
463- expect ( result ) . toBe ( BINARY_PATH ) ;
464+ expectPathsEqual ( result , BINARY_PATH ) ;
464465 expect ( memfs . existsSync ( BINARY_PATH ) ) . toBe ( true ) ;
465466 } ) ;
466467 } ) ;
@@ -494,7 +495,7 @@ describe("CliManager", () => {
494495 withSuccessfulDownload ( ) ;
495496 withSignatureResponses ( [ 200 ] ) ;
496497 const result = await manager . fetchBinary ( mockApi , "test" ) ;
497- expect ( result ) . toBe ( BINARY_PATH ) ;
498+ expectPathsEqual ( result , BINARY_PATH ) ;
498499 expect ( pgp . verifySignature ) . toHaveBeenCalled ( ) ;
499500 const sigFile = expectFileInDir ( BINARY_DIR , ".asc" ) ;
500501 expect ( sigFile ) . toBeDefined ( ) ;
@@ -505,7 +506,7 @@ describe("CliManager", () => {
505506 withSignatureResponses ( [ 404 , 200 ] ) ;
506507 mockUI . setResponse ( "Signature not found" , "Download signature" ) ;
507508 const result = await manager . fetchBinary ( mockApi , "test" ) ;
508- expect ( result ) . toBe ( BINARY_PATH ) ;
509+ expectPathsEqual ( result , BINARY_PATH ) ;
509510 expect ( mockAxios . get ) . toHaveBeenCalledTimes ( 3 ) ;
510511 const sigFile = expectFileInDir ( BINARY_DIR , ".asc" ) ;
511512 expect ( sigFile ) . toBeDefined ( ) ;
@@ -519,7 +520,7 @@ describe("CliManager", () => {
519520 ) ;
520521 mockUI . setResponse ( "Signature does not match" , "Run anyway" ) ;
521522 const result = await manager . fetchBinary ( mockApi , "test" ) ;
522- expect ( result ) . toBe ( BINARY_PATH ) ;
523+ expectPathsEqual ( result , BINARY_PATH ) ;
523524 expect ( memfs . existsSync ( BINARY_PATH ) ) . toBe ( true ) ;
524525 } ) ;
525526
@@ -539,7 +540,7 @@ describe("CliManager", () => {
539540 mockConfig . set ( "coder.disableSignatureVerification" , true ) ;
540541 withSuccessfulDownload ( ) ;
541542 const result = await manager . fetchBinary ( mockApi , "test" ) ;
542- expect ( result ) . toBe ( BINARY_PATH ) ;
543+ expectPathsEqual ( result , BINARY_PATH ) ;
543544 expect ( pgp . verifySignature ) . not . toHaveBeenCalled ( ) ;
544545 const files = readdir ( BINARY_DIR ) ;
545546 expect ( files . find ( ( file ) => file . includes ( ".asc" ) ) ) . toBeUndefined ( ) ;
@@ -553,7 +554,7 @@ describe("CliManager", () => {
553554 withHttpResponse ( status ) ;
554555 mockUI . setResponse ( message , "Run without verification" ) ;
555556 const result = await manager . fetchBinary ( mockApi , "test" ) ;
556- expect ( result ) . toBe ( BINARY_PATH ) ;
557+ expectPathsEqual ( result , BINARY_PATH ) ;
557558 expect ( pgp . verifySignature ) . not . toHaveBeenCalled ( ) ;
558559 } ) ;
559560
@@ -615,13 +616,16 @@ describe("CliManager", () => {
615616
616617 withSuccessfulDownload ( ) ;
617618 const result = await manager . fetchBinary ( mockApi , "test label" ) ;
618- expect ( result ) . toBe ( `${ pathWithSpaces } /test label/bin/${ BINARY_NAME } ` ) ;
619+ expectPathsEqual (
620+ result ,
621+ `${ pathWithSpaces } /test label/bin/${ BINARY_NAME } ` ,
622+ ) ;
619623 } ) ;
620624
621625 it ( "handles empty deployment label" , async ( ) => {
622626 withExistingBinary ( TEST_VERSION , "/path/base/bin" ) ;
623627 const result = await manager . fetchBinary ( mockApi , "" ) ;
624- expect ( result ) . toBe ( path . join ( BASE_PATH , "bin" , BINARY_NAME ) ) ;
628+ expectPathsEqual ( result , path . join ( BASE_PATH , "bin" , BINARY_NAME ) ) ;
625629 } ) ;
626630 } ) ;
627631
0 commit comments