Skip to content

Commit

Permalink
test: verification skip
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Apr 27, 2023
1 parent 0cd891a commit 15a51af
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/hooks/verifyInstallSignatureHook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ describe('plugin install hook', () => {
let sandbox: sinon.SinonSandbox;
let vConfig: VerificationConfig;
let promptSpy: sinon.SinonSpy;
let verifySpy: sinon.SinonSpy;

beforeEach(() => {
sandbox = sinon.createSandbox();
vConfig = new VerificationConfig();

vConfig.verifier = new InstallationVerification();
stubMethod(sandbox, vConfig.verifier, 'verify').callsFake(async () => {
verifySpy = stubMethod(sandbox, vConfig.verifier, 'verify').callsFake(async () => {
const err = new Error();
err.name = 'NotSigned';
throw err;
Expand Down Expand Up @@ -65,4 +66,16 @@ describe('plugin install hook', () => {
expect(promptSpy.called).to.be.true;
}
});

it('should skip signature verification for JIT plugins with matching version', async () => {
await hook.call(
{},
{
plugin: { name: '@ns/test', type: 'npm', tag: '1.2.3' },
config: { pjson: { oclif: { jitPlugins: { '@ns/test': '1.2.3' } } } },
}
);
expect(promptSpy.called).to.be.false;
expect(verifySpy.called).to.be.false;
});
});

0 comments on commit 15a51af

Please sign in to comment.