fix(shorebird_cli): shorebird channels create prompt for channel name (#495)
This commit is contained in:
@@ -60,7 +60,10 @@ You must either specify an app id via the "--$_appIdOption" flag or run this com
|
||||
return ExitCode.usage.code;
|
||||
}
|
||||
|
||||
final channel = results[_channelNameOption] as String;
|
||||
final channel = results[_channelNameOption] as String? ??
|
||||
logger.prompt(
|
||||
'''${lightGreen.wrap('?')} What is the name of the channel you would like to create?''',
|
||||
);
|
||||
|
||||
logger.info(
|
||||
'''
|
||||
|
||||
@@ -100,6 +100,29 @@ void main() {
|
||||
verify(() => logger.err(error)).called(1);
|
||||
});
|
||||
|
||||
test('prompts for channel name when not provided', () async {
|
||||
when(() => argResults['name']).thenReturn(null);
|
||||
when(() => logger.prompt(any())).thenReturn(channelName);
|
||||
when(
|
||||
() => codePushClient.createChannel(
|
||||
appId: any(named: 'appId'),
|
||||
channel: any(named: 'channel'),
|
||||
),
|
||||
).thenAnswer((_) async => channel);
|
||||
expect(await command.run(), ExitCode.success.code);
|
||||
verify(
|
||||
() => logger.prompt(
|
||||
'''${lightGreen.wrap('?')} What is the name of the channel you would like to create?''',
|
||||
),
|
||||
).called(1);
|
||||
verify(
|
||||
() => codePushClient.createChannel(
|
||||
appId: appId,
|
||||
channel: channel.name,
|
||||
),
|
||||
).called(1);
|
||||
});
|
||||
|
||||
test('returns ExitCode.success on success', () async {
|
||||
when(
|
||||
() => codePushClient.createChannel(
|
||||
|
||||
Reference in New Issue
Block a user