mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-08-31 17:49:33 +00:00
Add eslint and prettier.
This commit is contained in:
@@ -2,70 +2,98 @@ import * as validator from '../src/input-validator';
|
||||
|
||||
describe('api-level validator tests', () => {
|
||||
it('Throws if api-level is not a number', () => {
|
||||
const func = function() { validator.checkApiLevel('api'); }
|
||||
const func = () => {
|
||||
validator.checkApiLevel('api');
|
||||
};
|
||||
expect(func).toThrowError(`Unexpected API level: 'api'.`);
|
||||
});
|
||||
|
||||
it('Throws if api-level is not an integer', () => {
|
||||
const func = function() { validator.checkApiLevel('29.1'); }
|
||||
const func = () => {
|
||||
validator.checkApiLevel('29.1');
|
||||
};
|
||||
expect(func).toThrowError(`Unexpected API level: '29.1'.`);
|
||||
});
|
||||
|
||||
it('Throws if api-level is lower than min API supported', () => {
|
||||
const func = function() { validator.checkApiLevel('20'); }
|
||||
const func = () => {
|
||||
validator.checkApiLevel('20');
|
||||
};
|
||||
expect(func).toThrowError(`Minimum API level supported is ${validator.MIN_API_LEVEL}.`);
|
||||
});
|
||||
|
||||
it('Validates successfully with valid api-level', () => {
|
||||
const func1 = function() { validator.checkApiLevel('21'); }
|
||||
const func1 = () => {
|
||||
validator.checkApiLevel('21');
|
||||
};
|
||||
expect(func1).not.toThrow();
|
||||
|
||||
const func2 = function() { validator.checkApiLevel('29'); }
|
||||
const func2 = () => {
|
||||
validator.checkApiLevel('29');
|
||||
};
|
||||
expect(func2).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('target validator tests', () => {
|
||||
it('Throws if target is unknown', () => {
|
||||
const func = function() { validator.checkTarget('some-target'); }
|
||||
const func = () => {
|
||||
validator.checkTarget('some-target');
|
||||
};
|
||||
expect(func).toThrowError(`Value for input.target 'some-target' is unknown. Supported options: ${validator.VALID_TARGETS}`);
|
||||
});
|
||||
|
||||
it('Validates successfully with valid target', () => {
|
||||
const func1 = function() { validator.checkTarget('default'); }
|
||||
const func1 = () => {
|
||||
validator.checkTarget('default');
|
||||
};
|
||||
expect(func1).not.toThrow();
|
||||
|
||||
const func2 = function() { validator.checkTarget('google_apis'); }
|
||||
const func2 = () => {
|
||||
validator.checkTarget('google_apis');
|
||||
};
|
||||
expect(func2).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('abi validator tests', () => {
|
||||
it('Throws if abi is unknown', () => {
|
||||
const func = function() { validator.checkAbi('some-abi'); }
|
||||
const func = () => {
|
||||
validator.checkAbi('some-abi');
|
||||
};
|
||||
expect(func).toThrowError(`Value for input.abi 'some-abi' is unknown. Supported options: ${validator.VALID_ABIS}`);
|
||||
});
|
||||
|
||||
it('Validates successfully with valid abi', () => {
|
||||
const func1 = function() { validator.checkAbi('x86'); }
|
||||
const func1 = () => {
|
||||
validator.checkAbi('x86');
|
||||
};
|
||||
expect(func1).not.toThrow();
|
||||
|
||||
const func2 = function() { validator.checkAbi('x86_64'); }
|
||||
const func2 = () => {
|
||||
validator.checkAbi('x86_64');
|
||||
};
|
||||
expect(func2).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('headless validator tests', () => {
|
||||
it('Throws if headless is not a boolean', () => {
|
||||
const func = function() { validator.checkHeadless('yes'); }
|
||||
const func = () => {
|
||||
validator.checkHeadless('yes');
|
||||
};
|
||||
expect(func).toThrowError(`Input for input.headless should be either 'true' or 'false'.`);
|
||||
});
|
||||
|
||||
it('Validates successfully if headless is either true or false', () => {
|
||||
const func1 = function() { validator.checkHeadless('true'); }
|
||||
const func1 = () => {
|
||||
validator.checkHeadless('true');
|
||||
};
|
||||
expect(func1).not.toThrow();
|
||||
|
||||
const func2 = function() { validator.checkHeadless('false'); }
|
||||
const func2 = () => {
|
||||
validator.checkHeadless('false');
|
||||
};
|
||||
expect(func2).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user