2019-09-13 22:45:36 +03:00
|
|
|
import * as input from '../src/input'
|
2019-09-12 23:48:44 +03:00
|
|
|
|
|
|
|
const testEnvVars = {
|
|
|
|
INPUT_COMMAND: 'build',
|
2019-09-13 22:45:36 +03:00
|
|
|
// 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 ',
|
2019-09-12 23:48:44 +03:00
|
|
|
'INPUT_USE-CROSS': 'true',
|
|
|
|
INPUT_TOOLCHAIN: '+nightly'
|
|
|
|
}
|
|
|
|
|
|
|
|
describe('actions-rs/check', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
for (const key in testEnvVars)
|
|
|
|
process.env[key] = testEnvVars[key as keyof typeof testEnvVars]
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Parses action input into cargo input', async () => {
|
2019-09-13 22:45:36 +03:00
|
|
|
const result = input.parse();
|
2019-09-12 23:48:44 +03:00
|
|
|
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|