From dfddf92a8fc9e35f65ed8a07e225b801a1b8bec2 Mon Sep 17 00:00:00 2001 From: merceyz Date: Sat, 20 Apr 2024 15:02:18 +0200 Subject: [PATCH] test: update assertions --- tests/main.test.ts | 58 +++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/main.test.ts b/tests/main.test.ts index 3820bd17b..a32a42099 100644 --- a/tests/main.test.ts +++ b/tests/main.test.ts @@ -999,8 +999,8 @@ describe(`handle integrity checks`, () => { await xfs.mktempPromise(async cwd => { await expect(runCli(cwd, [`pnpm@1.x`, `--version`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Signature does not match/, - stderr: ``, + stderr: /Signature does not match/, + stdout: ``, }); await expect(runCli(cwd, [`yarn@stable`, `--version`], true)).resolves.toMatchObject({ exitCode: 1, @@ -1015,24 +1015,24 @@ describe(`handle integrity checks`, () => { await xfs.mktempPromise(async cwd => { await expect(runCli(cwd, [`pnpm`, `--version`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, - stderr: ``, + stderr: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, + stdout: ``, }); // A second time to validate the invalid version was not cached. await expect(runCli(cwd, [`pnpm`, `--version`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, - stderr: ``, + stderr: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, + stdout: ``, }); await expect(runCli(cwd, [`yarn`, `--version`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, - stderr: ``, + stderr: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, + stdout: ``, }); await expect(runCli(cwd, [`use`, `pnpm`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, - stderr: ``, + stderr: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, + stdout: ``, }); }); }); @@ -1042,24 +1042,24 @@ describe(`handle integrity checks`, () => { await xfs.mktempPromise(async cwd => { await expect(runCli(cwd, [`pnpm`, `--version`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Signature does not match/, - stderr: ``, + stderr: /Signature does not match/, + stdout: ``, }); // A second time to validate the invalid version was not cached. await expect(runCli(cwd, [`pnpm`, `--version`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Signature does not match/, - stderr: ``, + stderr: /Signature does not match/, + stdout: ``, }); await expect(runCli(cwd, [`yarn`, `--version`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Signature does not match/, - stderr: ``, + stderr: /Signature does not match/, + stdout: ``, }); await expect(runCli(cwd, [`use`, `pnpm`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Signature does not match/, - stderr: ``, + stderr: /Signature does not match/, + stdout: ``, }); }); }); @@ -1069,13 +1069,13 @@ describe(`handle integrity checks`, () => { await xfs.mktempPromise(async cwd => { await expect(runCli(cwd, [`yarn@1.9998.9999`, `--version`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Signature does not match/, - stderr: ``, + stderr: /Signature does not match/, + stdout: ``, }); await expect(runCli(cwd, [`use`, `yarn@1.9998.9999`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Signature does not match/, - stderr: ``, + stderr: /Signature does not match/, + stdout: ``, }); }); }); @@ -1085,13 +1085,13 @@ describe(`handle integrity checks`, () => { await xfs.mktempPromise(async cwd => { await expect(runCli(cwd, [`yarn@1.9998.9999`, `--version`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, - stderr: ``, + stderr: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, + stdout: ``, }); await expect(runCli(cwd, [`use`, `yarn@1.9998.9999`], true)).resolves.toMatchObject({ exitCode: 1, - stdout: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, - stderr: ``, + stderr: /Mismatch hashes. Expected [a-f0-9]{128}, got [a-f0-9]{128}/, + stdout: ``, }); }); }); @@ -1102,10 +1102,10 @@ describe(`handle integrity checks`, () => { const result = await runCli(cwd, [`yarn@1.9998.9999+sha1.deadbeef`, `--version`], true); expect(result).toMatchObject({ exitCode: 1, - stderr: ``, + stdout: ``, }); - const match = /Mismatch hashes. Expected deadbeef, got ([a-f0-9]{40})/.exec(result.stdout); - if (match == null) throw new Error(`Invalid output`, {cause: result.stdout}); + const match = /Mismatch hashes. Expected deadbeef, got ([a-f0-9]{40})/.exec(result.stderr); + if (match == null) throw new Error(`Invalid output`, {cause: result.stderr}); await expect(runCli(cwd, [`yarn@1.9998.9999+sha1.${match[1]}`, `--version`], true)).resolves.toMatchObject({ exitCode: 0, stdout: `yarn: Hello from custom registry\n`,