Skip to content

Commit 32b429a

Browse files
authored
Merge pull request #6 from LearningLocker/coverage
Improves test coverage.
2 parents c0ef0d3 + 6a29aeb commit 32b429a

File tree

11 files changed

+29
-17
lines changed

11 files changed

+29
-17
lines changed

dist/tests/describeIfiProp.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/// <reference types="mocha" />
21
import Test from './helpers/test';
32
import 'mocha';
43
declare var _default: (prop: string, describer: (test: Test) => void, test: Test) => Mocha.ISuite;

dist/tests/describeIfiProp.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
44
exports.default = function (prop, describer, test) {
55
return describe(prop, function () {
66
describer(function (value, valid) {
7-
return test((_a = {}, _a[prop] = value, _a), valid);
7+
var data = (_a = {}, _a[prop] = value, _a);
8+
test(data, valid);
89
var _a;
910
});
1011
});

dist/tests/describeInteractionProp.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ exports.default = function (validProps, type, test) {
1616
allComponents.filter(function (prop) {
1717
return !validProps.includes(prop);
1818
}).forEach(function (prop) {
19-
return itsInvalid_1.default((_a = {
19+
var data = (_a = {
2020
interactionType: type
2121
},
2222
_a[prop] = [],
23-
_a), "containing unsupported component " + prop + " for " + type, test);
23+
_a);
24+
var message = "containing unsupported component " + prop + " for " + type;
25+
itsInvalid_1.default(data, message, test);
2426
var _a;
2527
});
2628
};

dist/tests/describeProp.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ exports.default = function (missingValid, description) {
99
});
1010
describe(prop, function () {
1111
describer(function (value, valid) {
12-
return test(Object.assign({}, validData, (_a = {}, _a[prop] = value, _a)), valid);
12+
var data = (_a = {}, _a[prop] = value, _a);
13+
test(Object.assign({}, validData, data), valid);
1314
var _a;
1415
});
1516
});

dist/tests/helpers/agentSchema.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ exports.default = function (test) {
1313
describeIfiProp_1.default('mbox_sha1sum', factory_1.sha1, test);
1414
describeIfiProp_1.default('openid', factory_1.iri, test);
1515
describeIfiProp_1.default('account', factory_1.account, test);
16+
itsInvalid_1.default(10, 'not an object', test);
1617
itsInvalid_1.default({
1718
objectType: 'Agent',
1819
name: 'Test',

dist/tests/schemaRules/definition.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
var describeInteractionProp_1 = require("../describeInteractionProp");
33
var describeOptionalProp_1 = require("../describeOptionalProp");
44
var factory_1 = require("../factory");
5+
var itsInvalid_1 = require("../itsInvalid");
56
var validData = {};
67
Object.defineProperty(exports, "__esModule", { value: true });
78
exports.default = function (test) {
9+
itsInvalid_1.default(10, 'not an object', test);
810
describeOptionalProp_1.default('name', factory_1.languageMap, validData, test);
911
describeOptionalProp_1.default('description', factory_1.languageMap, validData, test);
1012
describeOptionalProp_1.default('type', factory_1.iri, validData, test);

src/tests/describeIfiProp.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import 'mocha';
33

44
export default (prop: string, describer: (test: Test) => void, test: Test) =>
55
describe(prop, () => {
6-
describer((value, valid) =>
7-
test({ [prop]: value }, valid)
8-
);
6+
describer((value, valid) => {
7+
const data = { [prop]: value };
8+
test(data, valid);
9+
});
910
});

src/tests/describeInteractionProp.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ export default (validProps: string[], type: string, test: Test) => {
1616
);
1717
allComponents.filter(prop =>
1818
!validProps.includes(prop)
19-
).forEach(prop =>
20-
itsInvalid({
19+
).forEach(prop => {
20+
const data = {
2121
interactionType: type,
2222
[prop]: [],
23-
}, `containing unsupported component ${prop} for ${type}`, test)
24-
);
23+
};
24+
const message = `containing unsupported component ${prop} for ${type}`;
25+
itsInvalid(data, message, test);
26+
});
2527
};

src/tests/describeProp.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ export default (missingValid: boolean, description: string) =>
88
test(omit(validData, prop), missingValid)
99
);
1010
describe(prop, () => {
11-
describer((value, valid) =>
12-
test(Object.assign({}, validData, { [prop]: value }), valid)
13-
);
11+
describer((value, valid) => {
12+
const data = { [prop]: value };
13+
test(Object.assign({}, validData, data), valid);
14+
});
1415
});
1516
};

src/tests/helpers/agentSchema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default (test: Test) => {
2020
describeIfiProp('mbox_sha1sum', sha1, test);
2121
describeIfiProp('openid', iri, test);
2222
describeIfiProp('account', account, test);
23+
itsInvalid(10, 'not an object', test);
2324
itsInvalid({
2425
objectType: 'Agent',
2526
name: 'Test',

0 commit comments

Comments
 (0)