Skip to content

Commit 575c15c

Browse files
authored
chore(deps): Bump (anishkny#47)
1 parent e305039 commit 575c15c

File tree

5 files changed

+48
-54
lines changed

5 files changed

+48
-54
lines changed

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,29 @@
3434
"release": "git push --dry-run && npm whoami && standard-version && git push --follow-tags origin master && npm publish"
3535
},
3636
"devDependencies": {
37-
"@commitlint/cli": "^8.1.0",
38-
"@commitlint/config-conventional": "^8.1.0",
39-
"ava": "^2.3.0",
40-
"firebase-admin": "^8.3.0",
41-
"firebase-functions": "^3.2.0",
42-
"firebase-functions-test": "^0.1.6",
43-
"husky": "^3.0.5",
44-
"nyc": "^13.3.0",
45-
"prettier": "^1.18.2",
46-
"standard-version": "^7.0.0",
47-
"tslint": "^5.18.0",
37+
"@commitlint/cli": "^8.3.5",
38+
"@commitlint/config-conventional": "^8.3.4",
39+
"ava": "^3.1.0",
40+
"firebase-admin": "^8.9.2",
41+
"firebase-functions": "^3.3.0",
42+
"firebase-functions-test": "^0.1.7",
43+
"husky": "^4.2.1",
44+
"nyc": "^15.0.0",
45+
"prettier": "^1.19.1",
46+
"standard-version": "^7.1.0",
47+
"tslint": "^6.0.0",
4848
"tslint-config-prettier": "^1.18.0",
49-
"typescript": "^3.5.3"
49+
"typescript": "^3.7.5"
5050
},
5151
"peerDependencies": {
52-
"firebase-admin": "^8.3.0",
53-
"firebase-functions": "^3.2.0"
52+
"firebase-admin": "^8.9.2",
53+
"firebase-functions": "^3.3.0"
5454
},
5555
"optionalDependencies": {
56-
"coveralls": "^3.0.6"
56+
"coveralls": "^3.0.9"
5757
},
5858
"dependencies": {
59-
"caller-path": "^2.0.0"
59+
"caller-path": "^3.0.0"
6060
},
6161
"husky": {
6262
"hooks": {

src/rules/deleteReferences.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ export interface DeleteReferencesRule extends Rule {
44
source: {
55
collection: string;
66
};
7-
targets: Array<{
7+
targets: {
88
collection: string;
99
foreignKey: string;
1010
isCollectionGroup?: boolean;
11-
}>;
11+
}[];
1212
hooks?: {
1313
pre?: Function;
1414
};

src/rules/replicateAttributes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ export interface ReplicateAttributesRule extends Rule {
44
source: {
55
collection: string;
66
};
7-
targets: Array<{
7+
targets: {
88
collection: string;
99
foreignKey: string;
1010
attributeMapping: {
1111
[sourceAttribute: string]: string;
1212
};
1313
isCollectionGroup?: boolean;
14-
}>;
14+
}[];
1515
hooks?: {
1616
pre?: Function;
1717
};

test/functions/integrify.rules.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ module.exports = [
2626
isCollectionGroup: true,
2727
},
2828
],
29-
hooks: {
30-
pre: (change, context) => {
31-
setState({ change, context });
32-
},
33-
},
3429
},
3530
{
3631
rule: 'DELETE_REFERENCES',
@@ -49,11 +44,6 @@ module.exports = [
4944
isCollectionGroup: true,
5045
},
5146
],
52-
hooks: {
53-
pre: (snap, context) => {
54-
setState({ snap, context });
55-
},
56-
},
5747
},
5848
{
5949
rule: 'MAINTAIN_COUNT',

test/unit.test.js

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ testsuites.forEach(testsuite => {
3434
t.truthy(sut.replicateMasterToDetail.run);
3535
});
3636
test(`[${name}] test REPLICATE_ATTRIBUTES`, async t =>
37-
testReplicateAttributes(sut, t));
37+
testReplicateAttributes(sut, t, name));
3838
test(`[${name}] test DELETE_REFERENCES`, async t =>
39-
testDeleteReferences(sut, t));
39+
testDeleteReferences(sut, t, name));
4040
test(`[${name}] test MAINTAIN_COUNT`, async t => testMaintainCount(sut, t));
4141
});
4242

43-
async function testReplicateAttributes(sut, t) {
43+
async function testReplicateAttributes(sut, t, name) {
4444
// Add a couple of detail documents to follow master
4545
const masterId = makeid();
4646
await db.collection('detail1').add({ masterId: masterId });
@@ -62,11 +62,13 @@ async function testReplicateAttributes(sut, t) {
6262
setState({ change: null, context: null });
6363
await wrapped(change, { params: { masterId: masterId } });
6464

65-
// Assert pre-hook was called
66-
const state = getState();
67-
t.truthy(state.change);
68-
t.truthy(state.context);
69-
t.is(state.context.params.masterId, masterId);
65+
// Assert pre-hook was called (only for rules-in-situ)
66+
if (name === 'rules-in-situ') {
67+
const state = getState();
68+
t.truthy(state.change);
69+
t.truthy(state.context);
70+
t.is(state.context.params.masterId, masterId);
71+
}
7072

7173
// Assert that attributes get replicated to detail documents
7274
await assertQuerySizeEventually(
@@ -95,7 +97,7 @@ async function testReplicateAttributes(sut, t) {
9597
await t.pass();
9698
}
9799

98-
async function testDeleteReferences(sut, t) {
100+
async function testDeleteReferences(sut, t, name) {
99101
// Create some docs referencing master doc
100102
const masterId = makeid();
101103
await db.collection('detail1').add({ masterId: masterId });
@@ -117,11 +119,13 @@ async function testDeleteReferences(sut, t) {
117119
setState({ snap: null, context: null });
118120
await wrapped(snap, { params: { masterId: masterId } });
119121

120-
// Assert pre-hook was called
121-
const state = getState();
122-
t.truthy(state.snap);
123-
t.truthy(state.context);
124-
t.is(state.context.params.masterId, masterId);
122+
// Assert pre-hook was called (only for rules-in-situ)
123+
if (name === 'rules-in-situ') {
124+
const state = getState();
125+
t.truthy(state.snap);
126+
t.truthy(state.context);
127+
t.is(state.context.params.masterId, masterId);
128+
}
125129

126130
// Assert referencing docs were deleted
127131
await assertQuerySizeEventually(
@@ -199,16 +203,16 @@ async function testMaintainCount(sut, t) {
199203
}
200204

201205
test('test error conditions', async t => {
202-
t.throws(() => integrify({}), /Input must be rule or config/i);
203-
t.throws(
204-
() => integrify({ rule: 'UNKNOWN_RULE_4a4e261a2e37' }),
205-
/Unknown rule/i
206-
);
207-
t.throws(() => require('./functions-bad-rules-file'), /Unknown rule/i);
208-
t.throws(
209-
() => require('./functions-absent-rules-file'),
210-
/Rules file not found/i
211-
);
206+
t.throws(() => integrify({}), { message: /Input must be rule or config/i });
207+
t.throws(() => integrify({ rule: 'UNKNOWN_RULE_4a4e261a2e37' }), {
208+
message: /Unknown rule/i,
209+
});
210+
t.throws(() => require('./functions-bad-rules-file'), {
211+
message: /Unknown rule/i,
212+
});
213+
t.throws(() => require('./functions-absent-rules-file'), {
214+
message: /Rules file not found/i,
215+
});
212216

213217
t.pass();
214218
});

0 commit comments

Comments
 (0)