Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mahrous-deriv committed Nov 29, 2022
1 parent 8fd75da commit ff3ce7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/Myriad/Storage/Implementation/Redis.pm
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ Returns a L<Future> which will resolve to true if the key exists in this hash.
=cut

async method hash_exists ($k, $hash_key) {
await $redis->hexists($k, $hash_key)
await $redis->hexists($k, $hash_key);
}

=head2 hash_count
Expand Down
17 changes: 9 additions & 8 deletions t/storage.t
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ for my $class (@classes) {
(async sub {
await $storage->set(some_key => 'value');
is(await $storage->get('some_key'), 'value', 'can read our value back');
await $storage->hash_set(some_hash => key => 'hash value');
is(await $storage->hash_get('some_hash', 'key'), 'hash value', 'can read our hash value back');
await $storage->hash_set(some_hash => key => 'hash_value');
is(await $storage->hash_get('some_hash', 'key'), 'hash_value', 'can read our hash value back');
is(await $storage->hash_add('some_hash', 'numeric', 3), 3, 'can increment a hash value');
is(await $storage->hash_add('some_hash', 'numeric', 2), 5, 'can increment a hash value again');
is(await $storage->hash_get('some_hash', 'key'), 'hash value', 'can read our original hash value back');
is(await $storage->hash_keys('some_hash'), ['key', 'numeric'], 'can read our hash keys back');
is(await $storage->hash_values('some_hash'), ['hash value', 5], 'can read our hash values back');
is(await $storage->hash_exists('some_hash'), 1, 'can recognize our hash exists');
is(await $storage->hash_exists('_hash'), ' ', 'can recognize our hash does not exist');
is(await $storage->hash_get('some_hash', 'key'), 'hash_value', 'can read our original hash value back');
is(await $storage->hash_keys('some_hash'), ('key', 'numeric'), 'can read our hash keys');
is(await $storage->hash_values('some_hash'), ( 'hash_value', 5 ), 'can read our hash values back');
is(await $storage->hash_exists('some_key', 'numeric'), 1, 'can recognize our hash exists');
is(await $storage->hash_exists('some_hash', 'newkey'), ' ', 'can recognize that newkey does not exist');
is(await $storage->hash_exists('some_hash', 'key'), 1, 'can recognize that key exists');
is(await $storage->hash_count('some_hash'), 4, 'can read our hash count');
is(await $storage->hash_as_list('some_hash'), ['key', 'hash value' ,'numeric', 5], 'can read our hash as list');
is(await $storage->hash_as_list('some_hash'), ['key', 'hash_value' ,'numeric', 5], 'can read our hash as list');
})->()->get;

# OrderedSet
Expand Down

0 comments on commit ff3ce7d

Please sign in to comment.