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