Import IKAR messenger client and server
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:ikar/core/plugins/plugin_manifest.dart';
|
||||
import 'package:ikar/frontend/commands/slash_command.dart';
|
||||
import 'package:ikar/frontend/commands/plugin_commands.dart';
|
||||
|
||||
void main() {
|
||||
const optional = PluginCommandArgumentManifest(
|
||||
name: 'optional',
|
||||
description: '',
|
||||
required: false,
|
||||
rest: false,
|
||||
);
|
||||
const text = PluginCommandArgumentManifest(
|
||||
name: 'text',
|
||||
description: '',
|
||||
required: true,
|
||||
rest: true,
|
||||
);
|
||||
test('empty optional field does not consume the required text', () {
|
||||
final raw = serializeCommandArguments(
|
||||
[optional, text],
|
||||
{'optional': '', 'text': 'alpha beta'},
|
||||
);
|
||||
expect(parseCommandArguments(raw, [optional, text]), {
|
||||
'optional': '',
|
||||
'text': 'alpha beta',
|
||||
});
|
||||
});
|
||||
test('quoted arguments round trip through the form', () {
|
||||
const values = {
|
||||
'optional': 'with "quotes" and spaces',
|
||||
'text': 'alpha beta',
|
||||
};
|
||||
final raw = serializeCommandArguments([optional, text], values);
|
||||
expect(parseCommandArguments(raw, [optional, text]), values);
|
||||
});
|
||||
test('usage includes optional and rest fields', () {
|
||||
const command = SlashCommand(
|
||||
'/synthetic',
|
||||
'Synthetic',
|
||||
arguments: [optional, text],
|
||||
);
|
||||
expect(command.usage, '/synthetic [optional] <text...>');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user