-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brian Butz
committed
Dec 10, 2019
1 parent
97149a0
commit 04bca47
Showing
3 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ cache: | |
mocha: | ||
script: | ||
- npm install | ||
- npm test | ||
- REDIS_HOST=redis npm test |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const redis = require("redis"); | ||
const assert = require("assert"); | ||
const redisHost = process.env.REDIS_HOST || 'localhost'; | ||
const promisify = require("util").promisify; | ||
|
||
describe('our cache', () => { | ||
let redisClient; | ||
|
||
beforeEach(() => { | ||
redisClient = redis.createClient({host: redisHost}); | ||
}); | ||
|
||
afterEach(() => { | ||
redisClient.quit(); | ||
}); | ||
|
||
it('stores stuff', async () => { | ||
const flushall = promisify(redisClient.flushall).bind(redisClient); | ||
const dbsize = promisify(redisClient.dbsize).bind(redisClient); | ||
const set = promisify(redisClient.set).bind(redisClient); | ||
const get = promisify(redisClient.get).bind(redisClient); | ||
|
||
await flushall(); | ||
assert.equal(await dbsize(), 0); | ||
await set('foo', 1234); | ||
assert.equal(await get('foo'), 1234); | ||
}); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
const assert = require('assert'); | ||
|
||
describe('foo', () => { | ||
describe('a working test', () => { | ||
it('works', () => { | ||
assert.equal(true, false); | ||
assert.equal(true, true); | ||
}); | ||
}); |