create without id
This commit is contained in:
parent
6ed5f764d8
commit
e24c89f8d9
2 changed files with 9 additions and 1 deletions
|
@ -38,7 +38,8 @@ class RedisService extends Service<String, Map<String, dynamic>> {
|
|||
else {
|
||||
var keyVar = await respCommands.client
|
||||
.writeArrayOfBulk(['INCR', _applyPrefix('angel_redis:id')]);
|
||||
throw keyVar;
|
||||
id = keyVar.payload.toString();
|
||||
data = new Map<String, dynamic>.from(data)..['id'] = id;
|
||||
}
|
||||
|
||||
await respCommands.set(_applyPrefix(id), json.encode(data));
|
||||
|
|
|
@ -20,4 +20,11 @@ main() async {
|
|||
var output = await service.create(input);
|
||||
expect(input, output);
|
||||
});
|
||||
test('create without id', () async {
|
||||
var input = {'bar': 'baz'};
|
||||
var output = await service.create(input);
|
||||
print(output);
|
||||
expect(output.keys, contains('id'));
|
||||
expect(output, containsPair('bar', 'baz'));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue