mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2024-12-27 04:55:49 +00:00
test: updated tests
This commit is contained in:
parent
2936fe8cda
commit
7c0fdd03f5
2 changed files with 52 additions and 32 deletions
|
@ -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()
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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()
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue