Skip to content

Commit

Permalink
chore: enable lab type tests (#128)
Browse files Browse the repository at this point in the history
Follow-up to #126.
  • Loading branch information
Marsup authored Aug 4, 2023
1 parent 2888daa commit 727f88d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 19 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
"@hapi/code": "^9.0.3",
"@hapi/eslint-plugin": "*",
"@hapi/lab": "^25.1.2",
"redis-parser": "^3.0.0"
"@types/node": "^16.18.39",
"redis-parser": "^3.0.0",
"typescript": "^5.1.6"
},
"scripts": {
"test": "lab -t 100 -a @hapi/code -L -m 15000",
"test": "lab -t 100 -a @hapi/code -L -m 15000 -Y",
"test-cov-html": "lab -r html -o coverage.html -a @hapi/code -L"
},
"license": "BSD-3-Clause"
Expand Down
49 changes: 32 additions & 17 deletions test/types.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
import { Engine } from '..';
import Redis, { Cluster } from 'ioredis';

const cache = new Engine<string>({
client: new Redis(),
host: 'localhost',
partition: 'test',
port: 2018,
});
async function test() {
const cache = new Engine<string>({
client: new Redis(),
host: 'localhost',
partition: 'test',
port: 2018,
});

cache.get({
segment: 'test',
id: 'test',
});
await cache.start()

cache.set({
segment: 'test',
id: 'test',
}, 'test', 123);
cache.get({
segment: 'test',
id: 'test',
});

cache.set({
segment: 'test',
id: 'test',
}, 'test', 123);

new Engine({
client: new Cluster([new Redis(), new Redis()])
});

new Engine({
client: new Cluster([
{
host: '127.0.0.1',
port: 27379
},
{
host: '127.0.0.2',
port: 27379
}
])
});
}

test();

0 comments on commit 727f88d

Please sign in to comment.