@sprucelabs/spruce-test-fixtures 60.1.160 → 60.1.162
Sign up to get free protection for your applications and to get access to all the features.
- package/build/__tests__/behavioral/views/ViewFixture.test.d.ts +7 -1
- package/build/__tests__/behavioral/views/ViewFixture.test.js +24 -2
- package/build/esm/__tests__/behavioral/views/ViewFixture.test.d.ts +7 -1
- package/build/esm/__tests__/behavioral/views/ViewFixture.test.js +27 -3
- package/build/esm/tests/fixtures/ViewFixture.js +8 -1
- package/build/tests/fixtures/ViewFixture.js +7 -0
- package/package.json +10 -10
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AbstractSkillViewController, SkillViewControllerLoadOptions, SpruceSchemas } from '@sprucelabs/heartwood-view-controllers';
|
1
|
+
import { AbstractSkillViewController, AbstractViewController, Card, SkillViewControllerLoadOptions, SpruceSchemas } from '@sprucelabs/heartwood-view-controllers';
|
2
2
|
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
|
3
3
|
export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
4
4
|
private static fixture;
|
@@ -51,6 +51,7 @@ export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
|
51
51
|
protected static canSetController(): Promise<void>;
|
52
52
|
protected static deviceIsSetOnFixtureAndFactory(): Promise<void>;
|
53
53
|
protected static newDeviceBeforeEach(): Promise<void>;
|
54
|
+
protected static mutesLogs(): Promise<void>;
|
54
55
|
private static ViewFixture;
|
55
56
|
private static buildLoadOptions;
|
56
57
|
private static ScopedByOrgVc;
|
@@ -83,12 +84,17 @@ declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.typ
|
|
83
84
|
interface ViewControllerMap {
|
84
85
|
scope: ScopeSvc;
|
85
86
|
client: ClientSvc;
|
87
|
+
logging: LoggingViewController;
|
86
88
|
}
|
87
89
|
}
|
88
90
|
interface Args {
|
89
91
|
hello?: string;
|
90
92
|
world?: number;
|
91
93
|
}
|
94
|
+
declare class LoggingViewController extends AbstractViewController<Card> {
|
95
|
+
getLog(): import("@sprucelabs/spruce-skill-utils").Log;
|
96
|
+
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
97
|
+
}
|
92
98
|
declare class ScopeSvc extends AbstractSkillViewController<Args> {
|
93
99
|
loadOptions: SkillViewControllerLoadOptions | null;
|
94
100
|
load(options: SkillViewControllerLoadOptions<Args>): Promise<void>;
|
@@ -429,6 +429,16 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest_1.
|
|
429
429
|
const device = this.fixture.getDevice();
|
430
430
|
test_utils_1.assert.isNotEqual(device, this.lastDevice);
|
431
431
|
}
|
432
|
+
static async mutesLogs() {
|
433
|
+
console.log = () => test_utils_1.assert.fail('should not be called');
|
434
|
+
console.warn = () => test_utils_1.assert.fail('should not be called');
|
435
|
+
console.error = () => test_utils_1.assert.fail('should not be called');
|
436
|
+
const vc = this.MockVc('logging');
|
437
|
+
const log = vc.getLog();
|
438
|
+
log.info('hey');
|
439
|
+
log.error('hey');
|
440
|
+
log.warn('hey');
|
441
|
+
}
|
432
442
|
static ViewFixture() {
|
433
443
|
return this.Fixture('view', {
|
434
444
|
controllerMap: {
|
@@ -468,14 +478,15 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest_1.
|
|
468
478
|
const vc = factory.Controller('scope', {});
|
469
479
|
return { vc, fixture: this.fixture };
|
470
480
|
}
|
471
|
-
static MockVc() {
|
481
|
+
static MockVc(named = 'card') {
|
472
482
|
const viewFixture = this.Fixture('view', {
|
473
483
|
controllerMap: {
|
474
484
|
card: Fake_svc_1.default,
|
485
|
+
logging: LoggingViewController,
|
475
486
|
},
|
476
487
|
});
|
477
488
|
const factory = viewFixture.getFactory();
|
478
|
-
const vc = factory.Controller(
|
489
|
+
const vc = factory.Controller(named, {
|
479
490
|
header: { title: 'hey' },
|
480
491
|
});
|
481
492
|
return vc;
|
@@ -621,10 +632,21 @@ __decorate([
|
|
621
632
|
__decorate([
|
622
633
|
(0, test_utils_1.test)()
|
623
634
|
], ViewFixtureTest, "newDeviceBeforeEach", null);
|
635
|
+
__decorate([
|
636
|
+
(0, test_utils_1.test)()
|
637
|
+
], ViewFixtureTest, "mutesLogs", null);
|
624
638
|
ViewFixtureTest = __decorate([
|
625
639
|
fake_1.default.login(DEMO_NUMBER_FORMATTED)
|
626
640
|
], ViewFixtureTest);
|
627
641
|
exports.default = ViewFixtureTest;
|
642
|
+
class LoggingViewController extends heartwood_view_controllers_1.AbstractViewController {
|
643
|
+
getLog() {
|
644
|
+
return this.log;
|
645
|
+
}
|
646
|
+
render() {
|
647
|
+
return {};
|
648
|
+
}
|
649
|
+
}
|
628
650
|
class ScopeSvc extends heartwood_view_controllers_1.AbstractSkillViewController {
|
629
651
|
constructor() {
|
630
652
|
super(...arguments);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AbstractSkillViewController, SkillViewControllerLoadOptions, SpruceSchemas } from '@sprucelabs/heartwood-view-controllers';
|
1
|
+
import { AbstractSkillViewController, AbstractViewController, Card, SkillViewControllerLoadOptions, SpruceSchemas } from '@sprucelabs/heartwood-view-controllers';
|
2
2
|
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
|
3
3
|
export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
4
4
|
private static fixture;
|
@@ -51,6 +51,7 @@ export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
|
51
51
|
protected static canSetController(): Promise<void>;
|
52
52
|
protected static deviceIsSetOnFixtureAndFactory(): Promise<void>;
|
53
53
|
protected static newDeviceBeforeEach(): Promise<void>;
|
54
|
+
protected static mutesLogs(): Promise<void>;
|
54
55
|
private static ViewFixture;
|
55
56
|
private static buildLoadOptions;
|
56
57
|
private static ScopedByOrgVc;
|
@@ -83,12 +84,17 @@ declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.typ
|
|
83
84
|
interface ViewControllerMap {
|
84
85
|
scope: ScopeSvc;
|
85
86
|
client: ClientSvc;
|
87
|
+
logging: LoggingViewController;
|
86
88
|
}
|
87
89
|
}
|
88
90
|
interface Args {
|
89
91
|
hello?: string;
|
90
92
|
world?: number;
|
91
93
|
}
|
94
|
+
declare class LoggingViewController extends AbstractViewController<Card> {
|
95
|
+
getLog(): import("@sprucelabs/spruce-skill-utils").Log;
|
96
|
+
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
97
|
+
}
|
92
98
|
declare class ScopeSvc extends AbstractSkillViewController<Args> {
|
93
99
|
loadOptions: SkillViewControllerLoadOptions | null;
|
94
100
|
load(options: SkillViewControllerLoadOptions<Args>): Promise<void>;
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
14
14
|
});
|
15
15
|
};
|
16
|
-
import { AbstractSkillViewController, ActiveRecordListViewController, AuthenticatorImpl, formAssert, SwipeViewControllerImpl, vcAssert, } from '@sprucelabs/heartwood-view-controllers';
|
16
|
+
import { AbstractSkillViewController, AbstractViewController, ActiveRecordListViewController, AuthenticatorImpl, formAssert, SwipeViewControllerImpl, vcAssert, } from '@sprucelabs/heartwood-view-controllers';
|
17
17
|
import { formatPhoneNumber } from '@sprucelabs/schema';
|
18
18
|
import { eventResponseUtil } from '@sprucelabs/spruce-event-utils';
|
19
19
|
import { assert, test } from '@sprucelabs/test-utils';
|
@@ -506,6 +506,18 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
|
506
506
|
assert.isNotEqual(device, this.lastDevice);
|
507
507
|
});
|
508
508
|
}
|
509
|
+
static mutesLogs() {
|
510
|
+
return __awaiter(this, void 0, void 0, function* () {
|
511
|
+
console.log = () => assert.fail('should not be called');
|
512
|
+
console.warn = () => assert.fail('should not be called');
|
513
|
+
console.error = () => assert.fail('should not be called');
|
514
|
+
const vc = this.MockVc('logging');
|
515
|
+
const log = vc.getLog();
|
516
|
+
log.info('hey');
|
517
|
+
log.error('hey');
|
518
|
+
log.warn('hey');
|
519
|
+
});
|
520
|
+
}
|
509
521
|
static ViewFixture() {
|
510
522
|
return this.Fixture('view', {
|
511
523
|
controllerMap: {
|
@@ -549,14 +561,15 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
|
549
561
|
const vc = factory.Controller('scope', {});
|
550
562
|
return { vc, fixture: this.fixture };
|
551
563
|
}
|
552
|
-
static MockVc() {
|
564
|
+
static MockVc(named = 'card') {
|
553
565
|
const viewFixture = this.Fixture('view', {
|
554
566
|
controllerMap: {
|
555
567
|
card: FakeSkillViewController,
|
568
|
+
logging: LoggingViewController,
|
556
569
|
},
|
557
570
|
});
|
558
571
|
const factory = viewFixture.getFactory();
|
559
|
-
const vc = factory.Controller(
|
572
|
+
const vc = factory.Controller(named, {
|
560
573
|
header: { title: 'hey' },
|
561
574
|
});
|
562
575
|
return vc;
|
@@ -702,10 +715,21 @@ __decorate([
|
|
702
715
|
__decorate([
|
703
716
|
test()
|
704
717
|
], ViewFixtureTest, "newDeviceBeforeEach", null);
|
718
|
+
__decorate([
|
719
|
+
test()
|
720
|
+
], ViewFixtureTest, "mutesLogs", null);
|
705
721
|
ViewFixtureTest = __decorate([
|
706
722
|
fake.login(DEMO_NUMBER_FORMATTED)
|
707
723
|
], ViewFixtureTest);
|
708
724
|
export default ViewFixtureTest;
|
725
|
+
class LoggingViewController extends AbstractViewController {
|
726
|
+
getLog() {
|
727
|
+
return this.log;
|
728
|
+
}
|
729
|
+
render() {
|
730
|
+
return {};
|
731
|
+
}
|
732
|
+
}
|
709
733
|
class ScopeSvc extends AbstractSkillViewController {
|
710
734
|
constructor() {
|
711
735
|
super(...arguments);
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
import { LocaleImpl } from '@sprucelabs/calendar-utils';
|
11
11
|
import { ActiveRecordCardViewController, AuthenticatorImpl, confirmTestPatcher, dialogTestPatcher, StubStorage, renderUtil, SpyDevice, SwipeViewControllerImpl, vcAssert, ViewControllerFactory, formAssert, } from '@sprucelabs/heartwood-view-controllers';
|
12
12
|
import { SchemaError } from '@sprucelabs/schema';
|
13
|
-
import { diskUtil } from '@sprucelabs/spruce-skill-utils';
|
13
|
+
import { buildLog, diskUtil } from '@sprucelabs/spruce-skill-utils';
|
14
14
|
import { ClientProxyDecorator } from '../../index.js';
|
15
15
|
import SpruceError from '../../errors/SpruceError.js';
|
16
16
|
import spyMapUtil from '../../utilities/SpyMapUtil.js';
|
@@ -97,6 +97,13 @@ class ViewFixture {
|
|
97
97
|
var _a;
|
98
98
|
return (_a = this.viewClient) !== null && _a !== void 0 ? _a : connectToApi(options);
|
99
99
|
}),
|
100
|
+
log: {
|
101
|
+
prefix: 'ViewFixture',
|
102
|
+
error: () => '',
|
103
|
+
warn: () => '',
|
104
|
+
info: () => '',
|
105
|
+
buildLog,
|
106
|
+
},
|
100
107
|
maps: spyMapUtil,
|
101
108
|
});
|
102
109
|
vcAssert._setVcFactory(this.vcFactory);
|
@@ -93,6 +93,13 @@ class ViewFixture {
|
|
93
93
|
var _a;
|
94
94
|
return (_a = this.viewClient) !== null && _a !== void 0 ? _a : connectToApi(options);
|
95
95
|
},
|
96
|
+
log: {
|
97
|
+
prefix: 'ViewFixture',
|
98
|
+
error: () => '',
|
99
|
+
warn: () => '',
|
100
|
+
info: () => '',
|
101
|
+
buildLog: spruce_skill_utils_1.buildLog,
|
102
|
+
},
|
96
103
|
maps: SpyMapUtil_1.default,
|
97
104
|
});
|
98
105
|
heartwood_view_controllers_1.vcAssert._setVcFactory(this.vcFactory);
|
package/package.json
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
"@sprucelabs/spruce-test-fixtures"
|
14
14
|
]
|
15
15
|
},
|
16
|
-
"version": "60.1.
|
16
|
+
"version": "60.1.162",
|
17
17
|
"files": [
|
18
18
|
"build/**/*",
|
19
19
|
"!build/__tests__",
|
@@ -62,17 +62,17 @@
|
|
62
62
|
"lint.tsc": "tsc -p . --noEmit"
|
63
63
|
},
|
64
64
|
"dependencies": {
|
65
|
-
"@sprucelabs/data-stores": "^26.4.
|
65
|
+
"@sprucelabs/data-stores": "^26.4.13",
|
66
66
|
"@sprucelabs/error": "^5.1.57",
|
67
|
-
"@sprucelabs/heartwood-view-controllers": "^108.40.
|
68
|
-
"@sprucelabs/mercury-client": "^41.0.
|
69
|
-
"@sprucelabs/mercury-core-events": "^22.1.
|
70
|
-
"@sprucelabs/mercury-event-emitter": "^41.0.
|
67
|
+
"@sprucelabs/heartwood-view-controllers": "^108.40.1",
|
68
|
+
"@sprucelabs/mercury-client": "^41.0.212",
|
69
|
+
"@sprucelabs/mercury-core-events": "^22.1.18",
|
70
|
+
"@sprucelabs/mercury-event-emitter": "^41.0.212",
|
71
71
|
"@sprucelabs/schema": "^29.3.11",
|
72
72
|
"@sprucelabs/spruce-core-schemas": "^39.0.179",
|
73
|
-
"@sprucelabs/spruce-event-utils": "^38.0.
|
74
|
-
"@sprucelabs/spruce-permission-utils": "^7.0.
|
75
|
-
"@sprucelabs/spruce-skill-booter": "^60.1.
|
73
|
+
"@sprucelabs/spruce-event-utils": "^38.0.207",
|
74
|
+
"@sprucelabs/spruce-permission-utils": "^7.0.358",
|
75
|
+
"@sprucelabs/spruce-skill-booter": "^60.1.162",
|
76
76
|
"@sprucelabs/spruce-skill-utils": "^30.1.66",
|
77
77
|
"@sprucelabs/test-utils": "^4.0.97",
|
78
78
|
"dotenv": "^16.3.1",
|
@@ -132,5 +132,5 @@
|
|
132
132
|
]
|
133
133
|
]
|
134
134
|
},
|
135
|
-
"gitHead": "
|
135
|
+
"gitHead": "c418931512de2aeafbb97b2d1b0bd48c121ffa2e"
|
136
136
|
}
|