@sprucelabs/test 7.7.267 → 7.7.271
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -5
- package/build/__tests__/Assert.test.d.ts +0 -37
- package/build/__tests__/Assert.test.js +0 -535
- package/build/__tests__/SpruceTest.test.d.ts +0 -12
- package/build/__tests__/SpruceTest.test.js +0 -70
- package/build/__tests__/StackCleaner.test.d.ts +0 -4
- package/build/__tests__/StackCleaner.test.js +0 -51
- package/build/__tests__/Stringify.test.d.ts +0 -6
- package/build/__tests__/Stringify.test.js +0 -148
- package/build/esm/__tests__/Assert.test.d.ts +0 -37
- package/build/esm/__tests__/Assert.test.js +0 -562
- package/build/esm/__tests__/SpruceTest.test.d.ts +0 -12
- package/build/esm/__tests__/SpruceTest.test.js +0 -91
- package/build/esm/__tests__/StackCleaner.test.d.ts +0 -4
- package/build/esm/__tests__/StackCleaner.test.js +0 -56
- package/build/esm/__tests__/Stringify.test.d.ts +0 -6
- package/build/esm/__tests__/Stringify.test.js +0 -123
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
import AbstractSpruceTest from '../AbstractSpruceTest.js';
|
|
17
|
-
import assert from '../assert.js';
|
|
18
|
-
import test from '../decorators.js';
|
|
19
|
-
import StackCleaner from '../StackCleaner.js';
|
|
20
|
-
export default class ErrorStackTest extends AbstractSpruceTest {
|
|
21
|
-
static removesExpected(stack, expected) {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const cleaned = StackCleaner.clean(stack);
|
|
24
|
-
assert.isEqual(cleaned, expected);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
__decorate([
|
|
29
|
-
test('removes test files', `Error: You called will-fail!
|
|
30
|
-
at Object.willFail (/Users/taylorromero/Development/SpruceLabs/spruce-test/src/assert.ts:53:17)
|
|
31
|
-
at Function.canRemoveTestFiles (/Users/taylorromero/Development/SpruceLabs/spruce-test/src/__tests__/ErrorStack.test.ts:8:10)
|
|
32
|
-
at Object.<anonymous> (/Users/taylorromero/Development/SpruceLabs/spruce-test/src/decorators.ts:36:11)
|
|
33
|
-
at Object.asyncJestTest (/Users/taylorromero/Development/SpruceLabs/spruce-test/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:100:37)
|
|
34
|
-
at /Users/taylorromero/Development/SpruceLabs/spruce-test/node_modules/jest-jasmine2/build/queueRunner.js:45:12
|
|
35
|
-
at new Promise (<anonymous>)
|
|
36
|
-
at mapper (/Users/taylorromero/Development/SpruceLabs/spruce-test/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
|
|
37
|
-
at /Users/taylorromero/Development/SpruceLabs/spruce-test/node_modules/jest-jasmine2/build/queueRunner.js:75:41
|
|
38
|
-
at processTicksAndRejections (internal/process/task_queues.js:97:5)`, `Error: You called will-fail!
|
|
39
|
-
at Function.canRemoveTestFiles (/Users/taylorromero/Development/SpruceLabs/spruce-test/src/__tests__/ErrorStack.test.ts:8:10)
|
|
40
|
-
at new Promise (<anonymous>)`),
|
|
41
|
-
test('drops babel crap', `TypeError: Cannot read property 'map' of undefined
|
|
42
|
-
at Object (/Users/taylorromero/Development/SpruceLabs/spruce-mercury-api/src/databases/mongo.utilities.ts:21:17)
|
|
43
|
-
at Array.forEach (<anonymous>)
|
|
44
|
-
at mapNestedIdValues (/Users/taylorromero/Development/SpruceLabs/spruce-mercury-api/src/databases/mongo.utilities.ts:20:2)
|
|
45
|
-
at Object.mongoUtil [as mapQuery] (/Users/taylorromero/Development/SpruceLabs/spruce-mercury-api/src/databases/mongo.utilities.ts:11:27)
|
|
46
|
-
at MongoDatabase.toMongo…
|
|
47
|
-
at Generator.next (/Users/taylorromero/Development/SpruceLabs/spruce-mercury-api/node_modules/regenerator-runtime/runtime.js:118:21)
|
|
48
|
-
at asyncGeneratorStep (/Users/taylorromero/Development/SpruceLabs/spruce-mercury-api/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
|
|
49
|
-
at _next (/Users/taylorromero/Development/SpruceLabs/spruce-mercury-api/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
|
|
50
|
-
at processTicksAndRejections (internal/process/task_queues.js:97:5)`, `TypeError: Cannot read property 'map' of undefined
|
|
51
|
-
at Object (/Users/taylorromero/Development/SpruceLabs/spruce-mercury-api/src/databases/mongo.utilities.ts:21:17)
|
|
52
|
-
at Array.forEach (<anonymous>)
|
|
53
|
-
at mapNestedIdValues (/Users/taylorromero/Development/SpruceLabs/spruce-mercury-api/src/databases/mongo.utilities.ts:20:2)
|
|
54
|
-
at Object.mongoUtil [as mapQuery] (/Users/taylorromero/Development/SpruceLabs/spruce-mercury-api/src/databases/mongo.utilities.ts:11:27)
|
|
55
|
-
at MongoDatabase.toMongo…`)
|
|
56
|
-
], ErrorStackTest, "removesExpected", null);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import AbstractSpruceTest from '..';
|
|
2
|
-
export default class StringifyTest extends AbstractSpruceTest {
|
|
3
|
-
protected static dropInPlaceholders(obj: any, expected: any): void;
|
|
4
|
-
protected static printsPlaceholderFields(obj: Record<string, any>, expected: string): void;
|
|
5
|
-
protected static canRenderWithoutStrippingCharactorsInTestReporter(obj: any): void;
|
|
6
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import chalk from 'chalk';
|
|
8
|
-
import AbstractSpruceTest, { assert } from '../index.js';
|
|
9
|
-
import test from '../decorators.js';
|
|
10
|
-
import assertUtil, { FUNCTION_PLACEHOLDER, UNDEFINED_PLACEHOLDER, NULL_PLACEHOLDER, CIRCULAR_PLACEHOLDER, } from '../utilities/assert.utility.js';
|
|
11
|
-
const teammate = {
|
|
12
|
-
firstName: 'tay',
|
|
13
|
-
};
|
|
14
|
-
const team = {
|
|
15
|
-
teammate: Object.assign({}, teammate),
|
|
16
|
-
};
|
|
17
|
-
team.teammate.team = team;
|
|
18
|
-
const team2 = {
|
|
19
|
-
teammate,
|
|
20
|
-
teammate2: teammate,
|
|
21
|
-
};
|
|
22
|
-
const team3 = {
|
|
23
|
-
teammate: Object.assign(Object.assign({}, teammate), { age: 100 }),
|
|
24
|
-
coach: {
|
|
25
|
-
name: {
|
|
26
|
-
firstName: 'tay',
|
|
27
|
-
age: 100,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
export default class StringifyTest extends AbstractSpruceTest {
|
|
32
|
-
static dropInPlaceholders(obj, expected) {
|
|
33
|
-
const placholder = assertUtil.dropInPlaceholders(obj);
|
|
34
|
-
assert.isEqualDeep(placholder, expected);
|
|
35
|
-
}
|
|
36
|
-
static printsPlaceholderFields(obj, expected) {
|
|
37
|
-
const stringified = assertUtil.stringify(obj);
|
|
38
|
-
assert.isEqual(stringified, '\n\n' + chalk.bold(assertUtil.replacePlaceholders(expected)) + '\n\n');
|
|
39
|
-
}
|
|
40
|
-
static canRenderWithoutStrippingCharactorsInTestReporter(obj) {
|
|
41
|
-
process.stderr.write(assertUtil.stringify(obj));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
__decorate([
|
|
45
|
-
test('placeholdering simple object', { test: true }, { test: true }),
|
|
46
|
-
test('placeholdering object with null', { test: null }, { test: NULL_PLACEHOLDER }),
|
|
47
|
-
test('placeholdering object with function', { test: () => { } }, { test: FUNCTION_PLACEHOLDER }),
|
|
48
|
-
test('placeholdering circular object', team, {
|
|
49
|
-
teammate: {
|
|
50
|
-
firstName: 'tay',
|
|
51
|
-
team: CIRCULAR_PLACEHOLDER,
|
|
52
|
-
},
|
|
53
|
-
}),
|
|
54
|
-
test('placeholdering same object on same level', team2, {
|
|
55
|
-
teammate: {
|
|
56
|
-
firstName: 'tay',
|
|
57
|
-
},
|
|
58
|
-
teammate2: {
|
|
59
|
-
firstName: 'tay',
|
|
60
|
-
},
|
|
61
|
-
}),
|
|
62
|
-
test('placeholdering objects with same values at different levels', team3, {
|
|
63
|
-
teammate: {
|
|
64
|
-
firstName: 'tay',
|
|
65
|
-
age: 100,
|
|
66
|
-
},
|
|
67
|
-
coach: {
|
|
68
|
-
name: {
|
|
69
|
-
firstName: 'tay',
|
|
70
|
-
age: 100,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
})
|
|
74
|
-
], StringifyTest, "dropInPlaceholders", null);
|
|
75
|
-
__decorate([
|
|
76
|
-
test('one level deep (undefined)', {
|
|
77
|
-
hello: 'world',
|
|
78
|
-
undefined,
|
|
79
|
-
}, `{
|
|
80
|
-
"hello": "world",
|
|
81
|
-
"undefined": "${UNDEFINED_PLACEHOLDER}"
|
|
82
|
-
}`),
|
|
83
|
-
test('one level deep (null)', {
|
|
84
|
-
hello: 'world',
|
|
85
|
-
null: null,
|
|
86
|
-
}, `{
|
|
87
|
-
"hello": "world",
|
|
88
|
-
"null": "${NULL_PLACEHOLDER}"
|
|
89
|
-
}`),
|
|
90
|
-
test('two levels deep', {
|
|
91
|
-
hello: 'world',
|
|
92
|
-
undefinedDeep: {
|
|
93
|
-
undefined,
|
|
94
|
-
},
|
|
95
|
-
}, `{
|
|
96
|
-
"hello": "world",
|
|
97
|
-
"undefinedDeep": {
|
|
98
|
-
"undefined": "${UNDEFINED_PLACEHOLDER}"
|
|
99
|
-
}
|
|
100
|
-
}`),
|
|
101
|
-
test('three levels deep', {
|
|
102
|
-
hello: 'world',
|
|
103
|
-
undefinedDeep: {
|
|
104
|
-
undefinedDeepAgain: {
|
|
105
|
-
undefined,
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
}, `{
|
|
109
|
-
"hello": "world",
|
|
110
|
-
"undefinedDeep": {
|
|
111
|
-
"undefinedDeepAgain": {
|
|
112
|
-
"undefined": "${UNDEFINED_PLACEHOLDER}"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}`),
|
|
116
|
-
test('prints a function nicely', { hello: () => { } }, `{
|
|
117
|
-
"hello": "${FUNCTION_PLACEHOLDER}"
|
|
118
|
-
}`)
|
|
119
|
-
], StringifyTest, "printsPlaceholderFields", null);
|
|
120
|
-
__decorate([
|
|
121
|
-
test.skip('array looks good', ['hello', 'world']),
|
|
122
|
-
test.skip('objects looks good', { hello: 'world' })
|
|
123
|
-
], StringifyTest, "canRenderWithoutStrippingCharactorsInTestReporter", null);
|