test: updated tests

This commit is contained in:
Jacob Parish 2023-11-21 13:31:24 -06:00
parent 2936fe8cda
commit 7c0fdd03f5
2 changed files with 52 additions and 32 deletions

View file

@ -300,4 +300,56 @@ describe('main tests', () => {
);
});
});
describe('corepack flag', () => {
it('should not enable corepack when no input', async () => {
inputs['corepack'] = '';
await main.run();
expect(getExecOutputSpy).not.toHaveBeenCalledWith(
'corepack',
expect.anything(),
expect.anything()
);
});
it('should not enable corepack when input is "false"', async () => {
inputs['corepack'] = 'false';
await main.run();
expect(getExecOutputSpy).not.toHaveBeenCalledWith(
'corepack',
expect.anything(),
expect.anything()
);
});
it('should enable corepack when input is "true"', async () => {
inputs['corepack'] = 'true';
await main.run();
expect(getExecOutputSpy).toHaveBeenCalledWith(
'corepack',
['enable'],
expect.anything()
);
});
it('should enable corepack with a single package manager', async () => {
inputs['corepack'] = 'npm';
await main.run();
expect(getExecOutputSpy).toHaveBeenCalledWith(
'corepack',
['enable', 'npm'],
expect.anything()
);
});
it('should enable corepack with multiple package managers', async () => {
inputs['corepack'] = 'npm yarn';
await main.run();
expect(getExecOutputSpy).toHaveBeenCalledWith(
'corepack',
['enable', 'npm', 'yarn'],
expect.anything()
);
});
});
});

View file

@ -825,36 +825,4 @@ describe('setup-node', () => {
}
);
});
describe('corepack flag', () => {
it('use corepack if specified', async () => {
inputs['corepack'] = 'true';
await main.run();
expect(getExecOutputSpy).toHaveBeenCalledWith(
'corepack',
['enable'],
expect.anything()
);
});
it('use corepack with given package manager', async () => {
inputs['corepack'] = 'npm';
await main.run();
expect(getExecOutputSpy).toHaveBeenCalledWith(
'corepack',
['enable', 'npm'],
expect.anything()
);
});
it('use corepack with multiple package managers', async () => {
inputs['corepack'] = 'npm yarn';
await main.run();
expect(getExecOutputSpy).toHaveBeenCalledWith(
'corepack',
['enable', 'npm', 'yarn'],
expect.anything()
);
});
});
});