@neurodevs/node-tdd 1.0.6 → 1.0.7
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 +1 -1
- package/.nvmrc +0 -1
- package/.vscode/launch.json +0 -53
- package/.vscode/settings.json +0 -62
- package/.vscode/tasks.json +0 -99
- package/build/__tests__/MockFetch.d.ts +0 -18
- package/build/__tests__/MockFetch.js +0 -55
- package/build/__tests__/MockFetch.js.map +0 -1
- package/build/__tests__/behavioral/AbstractModuleTest.test.d.ts +0 -5
- package/build/__tests__/behavioral/AbstractModuleTest.test.js +0 -22
- package/build/__tests__/behavioral/AbstractModuleTest.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.d.ts +0 -5
- package/build/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.js +0 -34
- package/build/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/Assert.test.d.ts +0 -45
- package/build/__tests__/behavioral/utilities/Assert.test.js +0 -645
- package/build/__tests__/behavioral/utilities/Assert.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.d.ts +0 -4
- package/build/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.js +0 -23
- package/build/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/MockFetch.test.d.ts +0 -28
- package/build/__tests__/behavioral/utilities/MockFetch.test.js +0 -211
- package/build/__tests__/behavioral/utilities/MockFetch.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/StackCleaner.test.d.ts +0 -4
- package/build/__tests__/behavioral/utilities/StackCleaner.test.js +0 -46
- package/build/__tests__/behavioral/utilities/StackCleaner.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.d.ts +0 -7
- package/build/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.js +0 -32
- package/build/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.d.ts +0 -4
- package/build/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.js +0 -19
- package/build/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/Stringify.test.d.ts +0 -5
- package/build/__tests__/behavioral/utilities/Stringify.test.js +0 -127
- package/build/__tests__/behavioral/utilities/Stringify.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/TestDecoratorResolver.test.d.ts +0 -7
- package/build/__tests__/behavioral/utilities/TestDecoratorResolver.test.js +0 -38
- package/build/__tests__/behavioral/utilities/TestDecoratorResolver.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/TestOnBasic.test.d.ts +0 -12
- package/build/__tests__/behavioral/utilities/TestOnBasic.test.js +0 -68
- package/build/__tests__/behavioral/utilities/TestOnBasic.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/TestOnInstance.test.d.ts +0 -28
- package/build/__tests__/behavioral/utilities/TestOnInstance.test.js +0 -289
- package/build/__tests__/behavioral/utilities/TestOnInstance.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.d.ts +0 -9
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.js +0 -118
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.d.ts +0 -5
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.js +0 -78
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.d.ts +0 -4
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.js +0 -23
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.d.ts +0 -4
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.js +0 -24
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/TestResolver.test.d.ts +0 -7
- package/build/__tests__/behavioral/utilities/TestResolver.test.js +0 -38
- package/build/__tests__/behavioral/utilities/TestResolver.test.js.map +0 -1
- package/build/__tests__/behavioral/utilities/TestResolverOnStatic.test.d.ts +0 -4
- package/build/__tests__/behavioral/utilities/TestResolverOnStatic.test.js +0 -20
- package/build/__tests__/behavioral/utilities/TestResolverOnStatic.test.js.map +0 -1
- package/build/__tests__/behavioral/workspace/JestJsonParser.test.d.ts +0 -18
- package/build/__tests__/behavioral/workspace/JestJsonParser.test.js +0 -267
- package/build/__tests__/behavioral/workspace/JestJsonParser.test.js.map +0 -1
- package/build/__tests__/behavioral/workspace/TestReporter.test.d.ts +0 -27
- package/build/__tests__/behavioral/workspace/TestReporter.test.js +0 -508
- package/build/__tests__/behavioral/workspace/TestReporter.test.js.map +0 -1
- package/build/__tests__/behavioral/workspace/TestRunner.test.d.ts +0 -15
- package/build/__tests__/behavioral/workspace/TestRunner.test.js +0 -99
- package/build/__tests__/behavioral/workspace/TestRunner.test.js.map +0 -1
- package/build/__tests__/behavioral/workspace/Widgets.test.d.ts +0 -16
- package/build/__tests__/behavioral/workspace/Widgets.test.js +0 -134
- package/build/__tests__/behavioral/workspace/Widgets.test.js.map +0 -1
- package/build/__tests__/mock-terminal-kit.d.ts +0 -79
- package/build/__tests__/mock-terminal-kit.js +0 -103
- package/build/__tests__/mock-terminal-kit.js.map +0 -1
- package/build/__tests__/support/AbstractForInstanceTest.d.ts +0 -4
- package/build/__tests__/support/AbstractForInstanceTest.js +0 -9
- package/build/__tests__/support/AbstractForInstanceTest.js.map +0 -1
- package/build/__tests__/support/AbstractLevelOneTest.d.ts +0 -3
- package/build/__tests__/support/AbstractLevelOneTest.js +0 -4
- package/build/__tests__/support/AbstractLevelOneTest.js.map +0 -1
- package/build/__tests__/support/AbstractLevelTwoTest.d.ts +0 -7
- package/build/__tests__/support/AbstractLevelTwoTest.js +0 -14
- package/build/__tests__/support/AbstractLevelTwoTest.js.map +0 -1
- package/build/__tests__/support/AbstractStaticTest.d.ts +0 -7
- package/build/__tests__/support/AbstractStaticTest.js +0 -14
- package/build/__tests__/support/AbstractStaticTest.js.map +0 -1
- package/build/__tests__/support/AbstractTestOnInstanceTest.d.ts +0 -22
- package/build/__tests__/support/AbstractTestOnInstanceTest.js +0 -23
- package/build/__tests__/support/AbstractTestOnInstanceTest.js.map +0 -1
- package/build/__tests__/support/AbstractTestOnInstanceWithHooks.d.ts +0 -26
- package/build/__tests__/support/AbstractTestOnInstanceWithHooks.js +0 -59
- package/build/__tests__/support/AbstractTestOnInstanceWithHooks.js.map +0 -1
- package/build/__tests__/support/jest.setup.d.ts +0 -1
- package/build/__tests__/support/jest.setup.js +0 -4
- package/build/__tests__/support/jest.setup.js.map +0 -1
- package/build/__tests__/support/onTestFileResult.d.ts +0 -244
- package/build/__tests__/support/onTestFileResult.js +0 -980
- package/build/__tests__/support/onTestFileResult.js.map +0 -1
- package/eslint.config.js +0 -3
- package/prettier.config.js +0 -3
- package/src/.spruce/settings.json +0 -4
- package/src/__tests__/MockFetch.ts +0 -100
- package/src/__tests__/behavioral/AbstractModuleTest.test.ts +0 -15
- package/src/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.ts +0 -31
- package/src/__tests__/behavioral/utilities/Assert.test.ts +0 -826
- package/src/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.ts +0 -14
- package/src/__tests__/behavioral/utilities/MockFetch.test.ts +0 -240
- package/src/__tests__/behavioral/utilities/StackCleaner.test.ts +0 -46
- package/src/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.ts +0 -34
- package/src/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.ts +0 -11
- package/src/__tests__/behavioral/utilities/Stringify.test.ts +0 -169
- package/src/__tests__/behavioral/utilities/TestDecoratorResolver.test.ts +0 -51
- package/src/__tests__/behavioral/utilities/TestOnBasic.test.ts +0 -62
- package/src/__tests__/behavioral/utilities/TestOnInstance.test.ts +0 -439
- package/src/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.ts +0 -237
- package/src/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.ts +0 -85
- package/src/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.ts +0 -14
- package/src/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.ts +0 -16
- package/src/__tests__/behavioral/utilities/TestResolver.test.ts +0 -48
- package/src/__tests__/behavioral/utilities/TestResolverOnStatic.test.ts +0 -12
- package/src/__tests__/behavioral/workspace/JestJsonParser.test.ts +0 -357
- package/src/__tests__/behavioral/workspace/TestReporter.test.ts +0 -584
- package/src/__tests__/behavioral/workspace/TestRunner.test.ts +0 -87
- package/src/__tests__/behavioral/workspace/Widgets.test.ts +0 -131
- package/src/__tests__/mock-terminal-kit.ts +0 -115
- package/src/__tests__/support/AbstractForInstanceTest.ts +0 -12
- package/src/__tests__/support/AbstractLevelOneTest.ts +0 -3
- package/src/__tests__/support/AbstractLevelTwoTest.ts +0 -16
- package/src/__tests__/support/AbstractStaticTest.ts +0 -16
- package/src/__tests__/support/AbstractTestOnInstanceTest.ts +0 -30
- package/src/__tests__/support/AbstractTestOnInstanceWithHooks.ts +0 -138
- package/src/__tests__/support/jest.setup.ts +0 -2
- package/src/__tests__/support/onTestFileResult.ts +0 -1008
- package/src/impl/AbstractModuleTest.ts +0 -67
- package/src/index.ts +0 -12
- package/src/utilities/AssertionError.ts +0 -14
- package/src/utilities/StackCleaner.ts +0 -14
- package/src/utilities/TestDecoratorResolver.ts +0 -118
- package/src/utilities/assert.ts +0 -583
- package/src/utilities/assert.utility.ts +0 -295
- package/src/utilities/decorators.ts +0 -167
- package/src/workspace/CommandService.ts +0 -256
- package/src/workspace/JestJsonParser.ts +0 -255
- package/src/workspace/TKButtonWidget.ts +0 -54
- package/src/workspace/TestLogItemGenerator.ts +0 -184
- package/src/workspace/TestReporter.ts +0 -880
- package/src/workspace/TestRunner.ts +0 -128
- package/src/workspace/TkBaseWidget.ts +0 -249
- package/src/workspace/TkInputWidget.ts +0 -83
- package/src/workspace/TkLayoutCellWidget.ts +0 -46
- package/src/workspace/TkLayoutWidget.ts +0 -181
- package/src/workspace/TkMenuBarWidget.ts +0 -95
- package/src/workspace/TkPopupWidget.ts +0 -47
- package/src/workspace/TkProgressBarWidget.ts +0 -54
- package/src/workspace/TkTextWidget.ts +0 -167
- package/src/workspace/TkWindowWidget.ts +0 -122
- package/src/workspace/WidgetFactory.ts +0 -33
- package/src/workspace/button.types.ts +0 -19
- package/src/workspace/duration.utility.ts +0 -34
- package/src/workspace/factory.types.ts +0 -101
- package/src/workspace/input.types.ts +0 -22
- package/src/workspace/keySelectChoices.ts +0 -134
- package/src/workspace/layout.types.ts +0 -40
- package/src/workspace/menuBar.types.ts +0 -24
- package/src/workspace/popup.types.ts +0 -17
- package/src/workspace/progressBar.types.ts +0 -13
- package/src/workspace/table.types.ts +0 -9
- package/src/workspace/termKit.utility.ts +0 -130
- package/src/workspace/terminal-kit.d.ts +0 -28
- package/src/workspace/test.types.ts +0 -34
- package/src/workspace/testRunner.cli.ts +0 -166
- package/src/workspace/text.types.ts +0 -27
- package/src/workspace/widget.utilities.ts +0 -35
- package/src/workspace/widgets.types.ts +0 -102
- package/src/workspace/window.types.ts +0 -22
- package/tsconfig.json +0 -24
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import AbstractModuleTest from '../../../impl/AbstractModuleTest.js'
|
|
2
|
-
import assert from '../../../utilities/assert.js'
|
|
3
|
-
import test from '../../../utilities/decorators.js'
|
|
4
|
-
import WidgetFactory from '../../../workspace/WidgetFactory.js'
|
|
5
|
-
|
|
6
|
-
export default class WidgetsTest extends AbstractModuleTest {
|
|
7
|
-
private static factory: WidgetFactory
|
|
8
|
-
|
|
9
|
-
protected static async beforeEach() {
|
|
10
|
-
await super.beforeEach()
|
|
11
|
-
this.factory = new WidgetFactory()
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@test()
|
|
15
|
-
protected static async canCreateFactory() {
|
|
16
|
-
assert.isTruthy(this.factory)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@test()
|
|
20
|
-
protected static async canCreateTextWidget() {
|
|
21
|
-
const log = this.buildText()
|
|
22
|
-
assert.isTruthy(log)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@test()
|
|
26
|
-
protected static async setsStartingFrame() {
|
|
27
|
-
const text = this.buildText()
|
|
28
|
-
assert.isEqualDeep(text.getFrame(), {
|
|
29
|
-
left: 0,
|
|
30
|
-
top: 0,
|
|
31
|
-
width: 4,
|
|
32
|
-
height: 4,
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@test()
|
|
37
|
-
protected static canCreateWindow() {
|
|
38
|
-
const window = this.factory.Widget('window', {})
|
|
39
|
-
assert.isTruthy(window)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@test()
|
|
43
|
-
protected static canCreateProgressBar() {
|
|
44
|
-
const progress = this.factory.Widget('progressBar', {
|
|
45
|
-
progress: 0,
|
|
46
|
-
})
|
|
47
|
-
assert.isTruthy(progress)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@test()
|
|
51
|
-
protected static canCreateText() {
|
|
52
|
-
const text = this.factory.Widget('text', {})
|
|
53
|
-
assert.isTruthy(text)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@test.skip('enable when ready to fake termkit')
|
|
57
|
-
protected static canCreateLayout() {
|
|
58
|
-
const window = this.factory.Widget('window', {})
|
|
59
|
-
const layout = this.factory.Widget('layout', {
|
|
60
|
-
parent: window,
|
|
61
|
-
width: '100%',
|
|
62
|
-
rows: [
|
|
63
|
-
{
|
|
64
|
-
id: 'row_1',
|
|
65
|
-
height: '100%',
|
|
66
|
-
columns: [
|
|
67
|
-
{
|
|
68
|
-
id: 'column_1',
|
|
69
|
-
width: '100%',
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
})
|
|
75
|
-
assert.isTruthy(layout)
|
|
76
|
-
|
|
77
|
-
const column = layout.getChildById('results')
|
|
78
|
-
|
|
79
|
-
assert.isTruthy(column)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
@test()
|
|
83
|
-
protected static async setFrameResyncsScrollPositionOnScrollableWidget() {
|
|
84
|
-
const text = this.buildScrollableText() as any
|
|
85
|
-
let capturedArgs: any[] | undefined
|
|
86
|
-
|
|
87
|
-
text.text.scrollable = true
|
|
88
|
-
text.text.scrollTo = (...args: any[]) => {
|
|
89
|
-
capturedArgs = args
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const currentScrollY = text.text.scrollY
|
|
93
|
-
|
|
94
|
-
text.setFrame({ left: 0, top: 0, width: 20, height: 10 })
|
|
95
|
-
|
|
96
|
-
assert.isEqualDeep(capturedArgs, [null, currentScrollY])
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@test()
|
|
100
|
-
protected static async scrollToTopCallsScrollToWithZero() {
|
|
101
|
-
const text = this.buildScrollableText() as any
|
|
102
|
-
let capturedArgs: any[] | undefined
|
|
103
|
-
|
|
104
|
-
text.text.scrollTo = (...args: any[]) => {
|
|
105
|
-
capturedArgs = args
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
text.scrollToTop()
|
|
109
|
-
|
|
110
|
-
assert.isEqualDeep(capturedArgs, [null, 0])
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
private static buildScrollableText() {
|
|
114
|
-
return this.factory.Widget('text', {
|
|
115
|
-
left: 0,
|
|
116
|
-
top: 0,
|
|
117
|
-
width: 20,
|
|
118
|
-
height: 10,
|
|
119
|
-
isScrollEnabled: true,
|
|
120
|
-
})
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
private static buildText() {
|
|
124
|
-
return this.factory.Widget('text', {
|
|
125
|
-
left: 0,
|
|
126
|
-
top: 0,
|
|
127
|
-
width: 4,
|
|
128
|
-
height: 4,
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
export class FakeElement {
|
|
2
|
-
public outputX: number
|
|
3
|
-
public outputY: number
|
|
4
|
-
public outputWidth: number
|
|
5
|
-
public outputHeight: number
|
|
6
|
-
public constructorOptions: Record<string, any>
|
|
7
|
-
private handlers: Record<string, Function[]> = {}
|
|
8
|
-
|
|
9
|
-
public constructor(options: Record<string, any> = {}) {
|
|
10
|
-
this.constructorOptions = options
|
|
11
|
-
this.outputX = options.x ?? 0
|
|
12
|
-
this.outputY = options.y ?? 0
|
|
13
|
-
this.outputWidth = options.width ?? 0
|
|
14
|
-
this.outputHeight = options.height ?? 0
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public on(event: string, cb: Function) {
|
|
18
|
-
if (!this.handlers[event]) {
|
|
19
|
-
this.handlers[event] = []
|
|
20
|
-
}
|
|
21
|
-
this.handlers[event].push(cb)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public draw() {}
|
|
25
|
-
public destroy() {}
|
|
26
|
-
public resize(options: Record<string, any>) {
|
|
27
|
-
if (options.x !== undefined) {
|
|
28
|
-
this.outputX = options.x
|
|
29
|
-
}
|
|
30
|
-
if (options.y !== undefined) {
|
|
31
|
-
this.outputY = options.y
|
|
32
|
-
}
|
|
33
|
-
if (options.width !== undefined) {
|
|
34
|
-
this.outputWidth = options.width
|
|
35
|
-
}
|
|
36
|
-
if (options.height !== undefined) {
|
|
37
|
-
this.outputHeight = options.height
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export class TextBox extends FakeElement {
|
|
43
|
-
public content = ''
|
|
44
|
-
public scrollY = 0
|
|
45
|
-
public scrollX = 0
|
|
46
|
-
public textAreaHeight = 0
|
|
47
|
-
public textBuffer = {
|
|
48
|
-
cy: 0,
|
|
49
|
-
selectionRegion: null as any,
|
|
50
|
-
setSelectionRegion(_: any) {},
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public setContent(content: string) {
|
|
54
|
-
this.content = content
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public setSizeAndPosition(opts: Record<string, any>) {
|
|
58
|
-
this.resize(opts)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public scrollToBottom() {}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export class Bar extends FakeElement {
|
|
65
|
-
public setValue(_: number) {}
|
|
66
|
-
public setContent(_: string) {}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export class Layout extends FakeElement {
|
|
70
|
-
public computed = { xmin: 0, ymin: 0, width: 80, height: 24 }
|
|
71
|
-
public zChildren: any[] = []
|
|
72
|
-
public updateLayout() {}
|
|
73
|
-
public addRow(_row: any) {}
|
|
74
|
-
public setRowHeight(_idx: number, _h: any) {}
|
|
75
|
-
public addColumn(_idx: number, _col: any) {}
|
|
76
|
-
public setColumnWidth(_opts: any) {}
|
|
77
|
-
public getRows() {
|
|
78
|
-
return []
|
|
79
|
-
}
|
|
80
|
-
public off(_event: string, _cb: any) {}
|
|
81
|
-
public onParentResize() {}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export class Palette {}
|
|
85
|
-
|
|
86
|
-
const fakeDocument = {
|
|
87
|
-
eventSource: { on(_event: string, _cb: any) {} },
|
|
88
|
-
__widget: null as any,
|
|
89
|
-
inputWidth: 120,
|
|
90
|
-
inputHeight: 40,
|
|
91
|
-
focusElement: { __widget: null },
|
|
92
|
-
giveFocusTo: (_el: any) => {},
|
|
93
|
-
destroy: () => {},
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const fakeTerm = {
|
|
97
|
-
createDocument: () => fakeDocument,
|
|
98
|
-
grabInput: (_opts: any) => {},
|
|
99
|
-
on: (_event: string, _cb: any) => {},
|
|
100
|
-
hideCursor: (_v: boolean) => {},
|
|
101
|
-
windowTitle: (_t: string) => {},
|
|
102
|
-
styleReset: () => {},
|
|
103
|
-
clear: () => {},
|
|
104
|
-
removeAllListeners: () => {},
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const terminalKit = {
|
|
108
|
-
terminal: fakeTerm,
|
|
109
|
-
TextBox,
|
|
110
|
-
Bar,
|
|
111
|
-
Layout,
|
|
112
|
-
Palette,
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export default terminalKit
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import assert from '../../utilities/assert.js'
|
|
2
|
-
|
|
3
|
-
export default abstract class AbstractForInstanceTest {
|
|
4
|
-
protected static wasBeforeAllCalled = false
|
|
5
|
-
public static async beforeAll() {
|
|
6
|
-
assert.isFalse(
|
|
7
|
-
this.wasBeforeAllCalled,
|
|
8
|
-
'beforeAll in parent class not referrenced'
|
|
9
|
-
)
|
|
10
|
-
this.wasBeforeAllCalled = true
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import AbstractModuleTest from '../../impl/AbstractModuleTest.js'
|
|
2
|
-
|
|
3
|
-
export default abstract class AbstractBeforeAllLevelTwoTest extends AbstractModuleTest {
|
|
4
|
-
protected static wasBeforeAllLevelTwoCalled = false
|
|
5
|
-
protected wasBeforeEachLevelTwoCalled = false
|
|
6
|
-
|
|
7
|
-
protected static async beforeAll() {
|
|
8
|
-
await super.beforeAll()
|
|
9
|
-
this.wasBeforeAllLevelTwoCalled = true
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
protected async beforeEach() {
|
|
13
|
-
await super.beforeEach()
|
|
14
|
-
this.wasBeforeEachLevelTwoCalled = true
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import AbstractModuleTest from '../../impl/AbstractModuleTest.js'
|
|
2
|
-
|
|
3
|
-
export default abstract class AbstractStaticTest extends AbstractModuleTest {
|
|
4
|
-
protected static didCallAnotherStaticMethodInBeforeEach = false
|
|
5
|
-
protected static didSetInBeforeAll: boolean
|
|
6
|
-
|
|
7
|
-
protected static async beforeAll() {
|
|
8
|
-
await super.beforeAll()
|
|
9
|
-
this.callAnotherStaticMethod()
|
|
10
|
-
this.didSetInBeforeAll = true
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
private static callAnotherStaticMethod() {
|
|
14
|
-
this.didCallAnotherStaticMethodInBeforeEach = true
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import AbstractModuleTest from '../../impl/AbstractModuleTest.js'
|
|
2
|
-
|
|
3
|
-
export default abstract class AbstractTestOnInstanceTest extends AbstractModuleTest {
|
|
4
|
-
public static beforeAllCount = 0
|
|
5
|
-
public static beforeEachCount = 0
|
|
6
|
-
public static afterEachCount = 0
|
|
7
|
-
|
|
8
|
-
public static beforeBeforeAllCount = 0
|
|
9
|
-
public static beforeBeforeAllCount2 = 0
|
|
10
|
-
public static afterBeforeAllCount = 0
|
|
11
|
-
public static afterBeforeAllCount2 = 0
|
|
12
|
-
|
|
13
|
-
public static beforeBeforeEach = 0
|
|
14
|
-
public static beforeBeforeEach2 = 0
|
|
15
|
-
|
|
16
|
-
public static afterBeforeEach = 0
|
|
17
|
-
public static afterBeforeEach2 = 0
|
|
18
|
-
|
|
19
|
-
public static beforeAfterEach = 0
|
|
20
|
-
public static beforeAfterEach2 = 0
|
|
21
|
-
|
|
22
|
-
public static afterAfterEach = 0
|
|
23
|
-
public static afterAfterEach2 = 0
|
|
24
|
-
|
|
25
|
-
public static beforeAfterAll = 0
|
|
26
|
-
public static beforeAfterAll2 = 0
|
|
27
|
-
|
|
28
|
-
public static afterAfterAll = 0
|
|
29
|
-
public static afterAfterAll2 = 0
|
|
30
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import assert from '../../utilities/assert.js'
|
|
2
|
-
import AbstractModuleTest from '../../impl/AbstractModuleTest.js'
|
|
3
|
-
|
|
4
|
-
export default abstract class AbstractTestOnInstanceWithHooksTest extends AbstractModuleTest {
|
|
5
|
-
public static beforeAllCount = 0
|
|
6
|
-
public beforeEachCount = 0
|
|
7
|
-
public afterEachCount = 0
|
|
8
|
-
|
|
9
|
-
public static beforeBeforeAllCount = 0
|
|
10
|
-
public static beforeBeforeAllCount2 = 0
|
|
11
|
-
public static afterBeforeAllCount = 0
|
|
12
|
-
public static afterBeforeAllCount2 = 0
|
|
13
|
-
|
|
14
|
-
public beforeBeforeEach = 0
|
|
15
|
-
public beforeBeforeEach2 = 0
|
|
16
|
-
|
|
17
|
-
public afterBeforeEach = 0
|
|
18
|
-
public afterBeforeEach2 = 0
|
|
19
|
-
|
|
20
|
-
public beforeAfterEach = 0
|
|
21
|
-
public beforeAfterEach2 = 0
|
|
22
|
-
|
|
23
|
-
public afterAfterEach = 0
|
|
24
|
-
public afterAfterEach2 = 0
|
|
25
|
-
|
|
26
|
-
public static beforeAfterAll = 0
|
|
27
|
-
public static beforeAfterAll2 = 0
|
|
28
|
-
|
|
29
|
-
public static afterAfterAll = 0
|
|
30
|
-
public static afterAfterAll2 = 0
|
|
31
|
-
|
|
32
|
-
protected static async beforeAll() {
|
|
33
|
-
assert.isEqual(
|
|
34
|
-
this.beforeBeforeAllCount,
|
|
35
|
-
1,
|
|
36
|
-
'beforeBeforeAll not called first'
|
|
37
|
-
)
|
|
38
|
-
assert.isEqual(
|
|
39
|
-
this.beforeBeforeAllCount2,
|
|
40
|
-
1,
|
|
41
|
-
'beforeBeforeAll not called second time'
|
|
42
|
-
)
|
|
43
|
-
assert.isEqual(
|
|
44
|
-
this.afterBeforeAllCount,
|
|
45
|
-
0,
|
|
46
|
-
'afterBeforeAll called too soon'
|
|
47
|
-
)
|
|
48
|
-
assert.isEqual(
|
|
49
|
-
this.afterBeforeAllCount2,
|
|
50
|
-
0,
|
|
51
|
-
'afterBeforeAll called too soon'
|
|
52
|
-
)
|
|
53
|
-
this.beforeAllCount += 1
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
protected async beforeEach() {
|
|
57
|
-
this.beforeEachCount += 1
|
|
58
|
-
|
|
59
|
-
assert.isEqual(
|
|
60
|
-
this.beforeBeforeEach,
|
|
61
|
-
this.beforeEachCount,
|
|
62
|
-
'beforeBeforeEach not called first'
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
assert.isEqual(
|
|
66
|
-
this.beforeBeforeEach2,
|
|
67
|
-
this.beforeEachCount,
|
|
68
|
-
'beforeBeforeEach not called second time'
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
assert.isEqual(
|
|
72
|
-
this.afterBeforeEach,
|
|
73
|
-
this.beforeEachCount - 1,
|
|
74
|
-
'afterBeforeEach called too soon'
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
assert.isEqual(
|
|
78
|
-
this.afterBeforeEach2,
|
|
79
|
-
this.beforeEachCount - 1,
|
|
80
|
-
'afterBeforeEach called too soon'
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
this.beforeEachCount++
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
protected async afterEach() {
|
|
87
|
-
this.afterEachCount += 1
|
|
88
|
-
|
|
89
|
-
assert.isEqual(
|
|
90
|
-
this.beforeAfterEach,
|
|
91
|
-
this.afterEachCount,
|
|
92
|
-
'beforeAfterEach not called first'
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
assert.isEqual(
|
|
96
|
-
this.beforeAfterEach2,
|
|
97
|
-
this.afterEachCount,
|
|
98
|
-
'beforeAfterEach not called second time'
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
assert.isEqual(
|
|
102
|
-
this.afterAfterEach,
|
|
103
|
-
this.afterEachCount - 1,
|
|
104
|
-
'afterAfterEach called too soon'
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
assert.isEqual(
|
|
108
|
-
this.afterAfterEach2,
|
|
109
|
-
this.afterEachCount - 1,
|
|
110
|
-
'afterAfterEach called too soon'
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
protected static async afterAll() {
|
|
115
|
-
assert.isEqual(this.beforeAllCount, 1, 'beforeAll not called once')
|
|
116
|
-
assert.isEqual(
|
|
117
|
-
this.afterBeforeAllCount,
|
|
118
|
-
1,
|
|
119
|
-
'afterBeforeAll not called first'
|
|
120
|
-
)
|
|
121
|
-
assert.isEqual(
|
|
122
|
-
this.afterBeforeAllCount2,
|
|
123
|
-
1,
|
|
124
|
-
'afterBeforeAll not called second time'
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
assert.isEqual(this.beforeAfterAll, 1, 'beforeAfterAll was not called')
|
|
128
|
-
assert.isEqual(this.beforeAfterAll2, 1, 'beforeAfterAll was not called')
|
|
129
|
-
|
|
130
|
-
assert.isEqual(this.afterAfterAll, 0, 'afterAfterAll called too soon')
|
|
131
|
-
assert.isEqual(this.afterAfterAll2, 0, 'afterAfterAll called too soon')
|
|
132
|
-
|
|
133
|
-
setTimeout(() => {
|
|
134
|
-
assert.isEqual(this.afterAfterAll, 1, 'afterAfterAll not called')
|
|
135
|
-
assert.isEqual(this.afterAfterAll2, 1, 'afterAfterAll not called')
|
|
136
|
-
}, 10)
|
|
137
|
-
}
|
|
138
|
-
}
|