-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.ts
More file actions
50 lines (44 loc) · 1.38 KB
/
test.ts
File metadata and controls
50 lines (44 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { assert, assertEquals } from "https://deno.land/std/testing/asserts.ts";
import { cargoBuild } from "./build.ts";
import { localInit, RedisClient } from "./mod.ts";
const { test, runTests } = Deno;
test(async function testSet() {
const client: RedisClient = new RedisClient({
host: '127.0.0.1',
port: 6379,
db: 0,
});
assert(client.client_id == 1);
const param = ["key1", "foo", "key2", "foo", "key3", "foo", "key4", "foo", "key5", "foo", "key6", "foo", "key7", "foo", "key7", "foo", "key8", "foo", "key9", "foo"];
const time = new Date().getTime();
await client.connection.hmset("test", param);
console.log(new Date().getTime() - time);
});
test(async function test_set_get() {
const client = new RedisClient({
host: '127.0.0.1',
port: 6379,
db: 0,
});
assert(client.client_id == 2);
await client.connection.set('test1', '121313');
let result = await client.connection.get('test1');
assert(result === '121313');
});
test(async function test_hset_hget() {
const client = new RedisClient({
host: '127.0.0.1',
port: 6379,
db: 0,
});
assert(client.client_id == 3);
await client.connection.hmset('test', ['key1', '123']);
let result = await client.connection.hmget('test', 'key1');
assert(result === '123');
});
// deno env compile rust
// if (Deno.env()['rebuild']) {
await cargoBuild();
// }
localInit();
await runTests();