rs-cargo/__tests__/input.test.ts
svartalf e35786a472 Use @actions-rs/core for cargo/cross execution.
Add problem matcher for cargo output
2019-09-25 10:08:33 +03:00

32 lines
1,021 B
TypeScript

import * as input from '../src/input'
const testEnvVars = {
INPUT_COMMAND: 'build',
// There are few unnecessary spaces here to check that args parser works properly
INPUT_ARGS: ' --release --target x86_64-unknown-linux-gnu --no-default-features --features unstable ',
'INPUT_USE-CROSS': 'true',
INPUT_TOOLCHAIN: '+nightly'
}
describe('actions-rs/cargo/input', () => {
beforeEach(() => {
for (const key in testEnvVars)
process.env[key] = testEnvVars[key as keyof typeof testEnvVars]
})
it('Parses action input into cargo input', async () => {
const result = input.get();
expect(result.command).toBe('build');
expect(result.args).toStrictEqual([
'--release',
'--target',
'x86_64-unknown-linux-gnu',
'--no-default-features',
'--features',
'unstable'
]);
expect(result.useCross).toBe(true);
expect(result.toolchain).toBe('nightly');
});
});