Skip to content

Commit

Permalink
Merge 620ab0f into 5e870f4
Browse files Browse the repository at this point in the history
  • Loading branch information
maritz committed Aug 30, 2018
2 parents 5e870f4 + 620ab0f commit 9afe796
Show file tree
Hide file tree
Showing 13 changed files with 386 additions and 179 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ tsOut/
.vscode/
coverage/
.nyc_output/
.DS_Store
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
language: node_js
node_js:
- "stable"
- "lts/*"
- "8"
- 'stable'
- 'lts/*'
- '8'
services:
- redis-server
before_script:
before_script:
- npm run build
script:
- npm run test
- npm run coverage:failIfLow
after_success:
after_success:
- npm run coverage:coveralls
env:
- NOHM_TEST_IOREDIS="false"
- NOHM_TEST_IOREDIS="true"
157 changes: 157 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
},
"dependencies": {
"debug": "^3.1.0",
"ioredis": "^4.0.0",
"lodash": "^4.17.10",
"redis": "^2.8.0",
"traverse": "^0.6.6",
Expand All @@ -55,6 +56,7 @@
"@types/async": "^2.0.47",
"@types/debug": "0.0.30",
"@types/express": "^4.16.0",
"@types/ioredis": "^4.0.1",
"@types/lodash": "^4.14.112",
"@types/node": "^10.5.2",
"@types/redis": "^2.8.4",
Expand Down
3 changes: 2 additions & 1 deletion test/featureTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -937,14 +937,15 @@ exports.deleteNonExistant = async (t) => {

try {
await user.remove();
t.fail('Removing a user that should not exist did not throw an error.');
} catch (err) {
t.same(
err,
new Error('not found'),
'Trying to delete an instance that doesn\'t exist did not return "not found".',
);
t.done();
}
t.done();
};

const MethodOverwrite = nohm.model('methodOverwrite', {
Expand Down
8 changes: 8 additions & 0 deletions test/findTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ exports.find = {
email: 'numericindextest@hurgel.de',
gender: 'male',
number: 3,
numberNonIndexed: 4,
},
{
// id: 2
Expand All @@ -124,6 +125,7 @@ exports.find = {
gender: 'male',
number: 4,
number2: 33,
numberNonIndexed: 4,
},
{
// id: 3
Expand All @@ -132,33 +134,39 @@ exports.find = {
gender: 'female',
number: 4,
number2: 1,
numberNonIndexed: 1,
},
{
// id: 4
name: 'uniquefind',
email: 'uniquefind@hurgel.de',
numberNonIndexed: 5,
},
{
// id: 5
name: 'indextest',
email: 'indextest@hurgel.de',
numberNonIndexed: 8,
},
{
// id: 6
name: 'indextest',
email: 'indextest2@hurgel.de',
numberNonIndexed: 200,
},
{
// id: 7
name: 'a_sort_first',
email: 'a_sort_first@hurgel.de',
number: 1,
numberNonIndexed: 0,
},
{
// id: 8
name: 'z_sort_last',
email: 'z_sort_last@hurgel.de',
number: 100000,
numberNonIndexed: 24.5,
},
],
function(users, ids) {
Expand Down
24 changes: 15 additions & 9 deletions test/pubsubTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,21 @@ module.exports = {
'set/get pubSub client': async (t) => {
t.expect(2);
await nohm.setPubSubClient(secondaryClient);
t.same(
nohm.getPubSubClient(),
secondaryClient,
"Second redis client wasn't set properly",
);
t.ok(
nohm.getPubSubClient().subscription_set,
"Second redis client isn't subscribed to anything",
);
const client = nohm.getPubSubClient();
t.same(client, secondaryClient, "Second redis client wasn't set properly");
const isIoRedis =
client.connected === undefined && client.status === 'ready';
if (isIoRedis) {
t.ok(
client.condition.subscriber !== false,
"Second redis client isn't subscribed to anything",
);
} else {
t.ok(
client.subscription_set,
"Second redis client isn't subscribed to anything",
);
}
t.done();
},

Expand Down
Loading

0 comments on commit 9afe796

Please sign in to comment.