Support choosing channel to download SDK components from.

This commit is contained in:
Yang
2021-08-28 19:15:33 +10:00
parent 1ded27b164
commit 1427331a62
14 changed files with 206 additions and 17 deletions
+17
View File
@@ -0,0 +1,17 @@
import * as mapper from '../src/channel-id-mapper';
describe('channel id mapper tests', () => {
it('Throws if channelName is unknown', () => {
const func = () => {
mapper.getChannelId('unknown-channel');
};
expect(func).toThrowError(`Unexpected channel name: 'unknown-channel'.`);
});
it('Returns expected channelId from channelName', () => {
expect(mapper.getChannelId('stable')).toBe(0);
expect(mapper.getChannelId('beta')).toBe(1);
expect(mapper.getChannelId('dev')).toBe(2);
expect(mapper.getChannelId('canary')).toBe(3);
});
});
+31
View File
@@ -102,6 +102,37 @@ describe('arch validator tests', () => {
});
});
describe('channel validator tests', () => {
it('Throws if channel is unknown', () => {
const func = () => {
validator.checkChannel('some-channel');
};
expect(func).toThrowError(`Value for input.channel 'some-channel' is unknown. Supported options: ${validator.VALID_CHANNELS}`);
});
it('Validates successfully with valid channel', () => {
const func1 = () => {
validator.checkChannel('stable');
};
expect(func1).not.toThrow();
const func2 = () => {
validator.checkChannel('beta');
};
expect(func2).not.toThrow();
const func3 = () => {
validator.checkChannel('dev');
};
expect(func3).not.toThrow();
const func4 = () => {
validator.checkChannel('canary');
};
expect(func4).not.toThrow();
});
});
describe('force-avd-creation validator tests', () => {
it('Throws if force-avd-creation is not a boolean', () => {
const func = () => {