Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
keroxp authored Mar 24, 2020
1 parent 32f7861 commit 5e4b778
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .denov
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.36.0
v0.37.1
2 changes: 1 addition & 1 deletion modules-lock.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"https://deno.land/std": {
"version": "@v0.36.0",
"version": "@v0.37.1",
"modules": [
"/util/async.ts",
"/testing/asserts.ts",
Expand Down
2 changes: 1 addition & 1 deletion modules.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"https://deno.land/std": {
"version": "@v0.36.0",
"version": "@v0.37.1",
"modules": [
"/util/async.ts",
"/testing/asserts.ts",
Expand Down
6 changes: 4 additions & 2 deletions pipeline_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { assertEquals } from "./vendor/https/deno.land/std/testing/asserts.ts";
import { connect } from "./redis.ts";
const { test } = Deno;

const test = Deno.test;
const addr = {
hostname: "127.0.0.1",
port: 6379
Expand Down Expand Up @@ -29,6 +28,7 @@ test(async function testPipeline() {
["integer", 1],
["integer", 1]
]);
redis.close();
});

test(async function testTx() {
Expand Down Expand Up @@ -71,6 +71,7 @@ test(async function testTx() {
parseInt(rep3[4][1] as string),
parseInt(rep3[0][1] as string) + 3
);
redis.close();
});

test("pipeline in concurrent", async () => {
Expand Down Expand Up @@ -105,4 +106,5 @@ test("pipeline in concurrent", async () => {
["bulk", "c"]
] // flush()
]);
redis.close();
});
1 change: 0 additions & 1 deletion pubsub_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { assertEquals } from "./vendor/https/deno.land/std/testing/asserts.ts";
import { connect } from "./redis.ts";
import { RedisPubSubMessage } from "./pubsub.ts";
const { test } = Deno;
const addr = {
hostname: "127.0.0.1",
Expand Down
7 changes: 4 additions & 3 deletions tests/connection_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ test("ping", async () => {
assertEquals(await client.ping("Deno"), "Deno");
});
test("quit", async () => {
const cli = await connect({ hostname: "127.0.0.1", port: 6379 });
assertEquals(await cli.quit(), "OK");
assertEquals(cli.isClosed, true);
const redis = await connect({ hostname: "127.0.0.1", port: 6379 });
assertEquals(await redis.quit(), "OK");
assertEquals(redis.isClosed, true);
redis.close();
});
test("select", async () => {
assertEquals(await client.select(1), "OK");
Expand Down
21 changes: 13 additions & 8 deletions tests/general_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import {
} from "../vendor/https/deno.land/std/testing/asserts.ts";
import { makeTest } from "./test_util.ts";

const { test, client, opts } = await makeTest("general");
const { test, client: redis, opts } = await makeTest("general");
test("conccurent", async function testConcurrent() {
let promises: Promise<any>[] = [];
for (const key of ["a", "b", "c"]) {
promises.push(client.set(key, key));
promises.push(redis.set(key, key));
}
await Promise.all(promises);
promises = [];
for (const key of ["a", "b", "c"]) {
promises.push(client.get(key));
promises.push(redis.get(key));
}
const [a, b, c] = await Promise.all(promises);
assertEquals(a, "a");
Expand All @@ -24,23 +24,28 @@ test("conccurent", async function testConcurrent() {

test("db0", async function testDb0Option() {
const key = "exists";
await client.set(key, "aaa");
const exists1 = await client.exists(key);
const client1 = await connect({ ...opts, db: 0 });
await client1.set(key, "aaa");
const exists1 = await client1.exists(key);
assertEquals(exists1, 1);
const client2 = await connect({ ...opts, db: 0 });
const exists2 = await client2.exists(key);
assertEquals(exists2, 1);
client1.close();
client2.close();
});

test("exists", async function testDb1Option() {
const key = "exists";
const client1 = await connect({ ...opts, db: 0 });
await client.set(key, "aaa");
await client1.set(key, "aaa");
const exists1 = await client1.exists(key);
assertEquals(exists1, 1);
const client2 = await connect({ ...opts, db: 1 });
const exists2 = await client2.exists(key);
assertEquals(exists2, 0);
client1.close();
client2.close();
});

[Infinity, NaN, "", "port"].forEach(v => {
Expand All @@ -53,8 +58,8 @@ test("exists", async function testDb1Option() {

test("execRawReply", async () => {
assertEquals(
await client.executor.exec("SET", "key", "a"),
await redis.executor.exec("SET", "key", "a"),
["status", "OK"]
);
assertEquals(await client.executor.exec("GET", "key"), ["bulk", "a"]);
assertEquals(await redis.executor.exec("GET", "key"), ["bulk", "a"]);
});
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/fmt/colors.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/std@v0.36.0/fmt/colors.ts";
export * from "https://deno.land/std@v0.37.1/fmt/colors.ts";
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/io/bufio.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/std@v0.36.0/io/bufio.ts";
export * from "https://deno.land/std@v0.37.1/io/bufio.ts";
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/testing/asserts.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/std@v0.36.0/testing/asserts.ts";
export * from "https://deno.land/std@v0.37.1/testing/asserts.ts";
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/util/async.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/std@v0.36.0/util/async.ts";
export * from "https://deno.land/std@v0.37.1/util/async.ts";

0 comments on commit 5e4b778

Please sign in to comment.