Created
April 5, 2018 16:33
-
-
Save jhoerr/389a052c8d092c1e0e12c675e830de3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as redis from "redis"; | |
import * as util from "util"; | |
describe("Redis cache", () => { | |
const port = 6379; | |
const host = "iubot-test.redis-test.uits.iu.edu"; | |
const token = "...TOKEN..."; | |
const client = redis.createClient({ | |
host: host, | |
port: port, | |
password: token, | |
tls: { | |
servername: host, | |
checkServerIdentity(servername, cert) { | |
return undefined; | |
} | |
} | |
}); | |
it("should ping the server successfully", async () => { | |
const ping = util.promisify(client.ping).bind(client); | |
const actual = await ping(); | |
expect(actual).toBe("PONG"); | |
}); | |
it("should set/get a value", async () => { | |
const get = util.promisify(client.get).bind(client); | |
const set = util.promisify(client.set).bind(client); | |
await set("pug", "cute"); | |
const actual = await get("pug"); | |
expect(actual).toBe("cute"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment