@sprucelabs/spruce-test-fixtures 45.2.9 → 46.0.2
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/build/__tests__/behavioral/CanUseStoresSetupInBeforeEach.test.d.ts +7 -0
- package/build/__tests__/behavioral/CanUseStoresSetupInBeforeEach.test.js +41 -0
- package/build/__tests__/behavioral/DatabaseFixture.test.d.ts +7 -0
- package/build/__tests__/behavioral/DatabaseFixture.test.js +59 -0
- package/build/__tests__/behavioral/DbResetsAsExpected.test.d.ts +5 -0
- package/build/__tests__/behavioral/DbResetsAsExpected.test.js +34 -0
- package/build/__tests__/behavioral/DecoratoringEmitToPassThroughProxy.test.d.ts +15 -0
- package/build/__tests__/behavioral/DecoratoringEmitToPassThroughProxy.test.js +109 -0
- package/build/__tests__/behavioral/DelaysConnectWhenOnlyUsingLoginDecorator.test.d.ts +4 -0
- package/build/__tests__/behavioral/DelaysConnectWhenOnlyUsingLoginDecorator.test.js +34 -0
- package/build/__tests__/behavioral/DisablingSchemaValidationOnTest.test.d.ts +5 -0
- package/build/__tests__/behavioral/DisablingSchemaValidationOnTest.test.js +26 -0
- package/build/__tests__/behavioral/DoesntResetAccountIfOnlySeedingLocally.test.d.ts +8 -0
- package/build/__tests__/behavioral/DoesntResetAccountIfOnlySeedingLocally.test.js +65 -0
- package/build/__tests__/behavioral/DummyStore.d.ts +55 -0
- package/build/__tests__/behavioral/DummyStore.js +36 -0
- package/build/__tests__/behavioral/FakingEventResponses.test.d.ts +12 -0
- package/build/__tests__/behavioral/FakingEventResponses.test.js +125 -0
- package/build/__tests__/behavioral/FixtureFactory.test.d.ts +7 -0
- package/build/__tests__/behavioral/FixtureFactory.test.js +79 -0
- package/build/__tests__/behavioral/LocationFixture.test.d.ts +15 -0
- package/build/__tests__/behavioral/LocationFixture.test.js +128 -0
- package/build/__tests__/behavioral/LoginDecoratorHandlingProxiesForMe.test.d.ts +12 -0
- package/build/__tests__/behavioral/LoginDecoratorHandlingProxiesForMe.test.js +92 -0
- package/build/__tests__/behavioral/MakingSureLocalEventsAreHandledLocally.test.d.ts +4 -0
- package/build/__tests__/behavioral/MakingSureLocalEventsAreHandledLocally.test.js +29 -0
- package/build/__tests__/behavioral/MercuryFixture.test.d.ts +19 -0
- package/build/__tests__/behavioral/MercuryFixture.test.js +175 -0
- package/build/__tests__/behavioral/OrganizationFixture.test.d.ts +31 -0
- package/build/__tests__/behavioral/OrganizationFixture.test.js +331 -0
- package/build/__tests__/behavioral/PatchingConsoleErrorToErrorStream.test.d.ts +4 -0
- package/build/__tests__/behavioral/PatchingConsoleErrorToErrorStream.test.js +21 -0
- package/build/__tests__/behavioral/PersonFixture.test.d.ts +22 -0
- package/build/__tests__/behavioral/PersonFixture.test.js +224 -0
- package/build/__tests__/behavioral/PhoneNumberIncrementor.test.d.ts +11 -0
- package/build/__tests__/behavioral/PhoneNumberIncrementor.test.js +95 -0
- package/build/__tests__/behavioral/ResettingAccountLocationsInBeforeAll.test.d.ts +8 -0
- package/build/__tests__/behavioral/ResettingAccountLocationsInBeforeAll.test.js +60 -0
- package/build/__tests__/behavioral/ResettingAccountOrgsInAfterAll.test.d.ts +5 -0
- package/build/__tests__/behavioral/ResettingAccountOrgsInAfterAll.test.js +37 -0
- package/build/__tests__/behavioral/ResettingAccountOrgsInBeforeAll.test.d.ts +7 -0
- package/build/__tests__/behavioral/ResettingAccountOrgsInBeforeAll.test.js +44 -0
- package/build/__tests__/behavioral/ResettingFixtureFieldsBeforeEach.test.d.ts +10 -0
- package/build/__tests__/behavioral/ResettingFixtureFieldsBeforeEach.test.js +130 -0
- package/build/__tests__/behavioral/ResettingLocalEventListeningBeforeSeeding.test.d.ts +7 -0
- package/build/__tests__/behavioral/ResettingLocalEventListeningBeforeSeeding.test.js +42 -0
- package/build/__tests__/behavioral/RetainsContractWhenLoggingInUsingDecotorator.test.d.ts +6 -0
- package/build/__tests__/behavioral/RetainsContractWhenLoggingInUsingDecotorator.test.js +37 -0
- package/build/__tests__/behavioral/RoleFixture.test.d.ts +15 -0
- package/build/__tests__/behavioral/RoleFixture.test.js +118 -0
- package/build/__tests__/behavioral/SeedingData.test.d.ts +24 -0
- package/build/__tests__/behavioral/SeedingData.test.js +271 -0
- package/build/__tests__/behavioral/SkillFixture.test.d.ts +13 -0
- package/build/__tests__/behavioral/SkillFixture.test.js +116 -0
- package/build/__tests__/behavioral/StoreFixture.test.d.ts +23 -0
- package/build/__tests__/behavioral/StoreFixture.test.js +156 -0
- package/build/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.d.ts +9 -0
- package/build/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.js +71 -0
- package/build/__tests__/behavioral/faking/FakeDecorator.test.d.ts +45 -0
- package/build/__tests__/behavioral/faking/FakeDecorator.test.js +418 -0
- package/build/__tests__/behavioral/faking/FakeDecoratorSetsPerson.test.d.ts +4 -0
- package/build/__tests__/behavioral/faking/FakeDecoratorSetsPerson.test.js +23 -0
- package/build/__tests__/behavioral/faking/FakeDecoratorWhoAmI.test.d.ts +4 -0
- package/build/__tests__/behavioral/faking/FakeDecoratorWhoAmI.test.js +27 -0
- package/build/__tests__/behavioral/faking/FakeThemeManager.test.d.ts +8 -0
- package/build/__tests__/behavioral/faking/FakeThemeManager.test.js +93 -0
- package/build/__tests__/behavioral/faking/FakingAddingPeopleToALocation.test.d.ts +8 -0
- package/build/__tests__/behavioral/faking/FakingAddingPeopleToALocation.test.js +56 -0
- package/build/__tests__/behavioral/faking/FakingAddingPeopleToAnOrg.test.d.ts +14 -0
- package/build/__tests__/behavioral/faking/FakingAddingPeopleToAnOrg.test.js +141 -0
- package/build/__tests__/behavioral/faking/FakingInBeforeEach.test.d.ts +6 -0
- package/build/__tests__/behavioral/faking/FakingInBeforeEach.test.js +42 -0
- package/build/__tests__/behavioral/faking/FakingRoleEvents.test.d.ts +19 -0
- package/build/__tests__/behavioral/faking/FakingRoleEvents.test.js +140 -0
- package/build/__tests__/behavioral/faking/FakingSkillEvents.test.d.ts +24 -0
- package/build/__tests__/behavioral/faking/FakingSkillEvents.test.js +174 -0
- package/build/__tests__/behavioral/faking/UpdatePerson.test.d.ts +4 -0
- package/build/__tests__/behavioral/faking/UpdatePerson.test.js +32 -0
- package/build/__tests__/behavioral/faking/UsingFakeDecorators.test.d.ts +35 -0
- package/build/__tests__/behavioral/faking/UsingFakeDecorators.test.js +321 -0
- package/build/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.d.ts +4 -0
- package/build/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.js +48 -0
- package/build/__tests__/behavioral/faking/WhoAmI.test.d.ts +19 -0
- package/build/__tests__/behavioral/faking/WhoAmI.test.js +103 -0
- package/build/__tests__/behavioral/maps/SpyingMapUtil.test.d.ts +10 -0
- package/build/__tests__/behavioral/maps/SpyingMapUtil.test.js +76 -0
- package/build/__tests__/behavioral/seeding/UsingDecorators.test.d.ts +37 -0
- package/build/__tests__/behavioral/seeding/UsingDecorators.test.js +266 -0
- package/build/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.d.ts +14 -0
- package/build/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.js +113 -0
- package/build/__tests__/behavioral/views/CheckingPermissions.test.d.ts +24 -0
- package/build/__tests__/behavioral/views/CheckingPermissions.test.js +162 -0
- package/build/__tests__/behavioral/views/FakingSkillViewControllers.test.d.ts +12 -0
- package/build/__tests__/behavioral/views/FakingSkillViewControllers.test.js +55 -0
- package/build/__tests__/behavioral/views/Routing.test.d.ts +31 -0
- package/build/__tests__/behavioral/views/Routing.test.js +141 -0
- package/build/__tests__/behavioral/views/TestingScope.test.d.ts +9 -0
- package/build/__tests__/behavioral/views/TestingScope.test.js +67 -0
- package/build/__tests__/behavioral/views/ViewFixture.test.d.ts +102 -0
- package/build/__tests__/behavioral/views/ViewFixture.test.js +652 -0
- package/build/__tests__/behavioral/views/WorkingWithTimezones.test.d.ts +11 -0
- package/build/__tests__/behavioral/views/WorkingWithTimezones.test.js +55 -0
- package/build/__tests__/support/AbstractFakeDecoratorTest.d.ts +5 -0
- package/build/__tests__/support/AbstractFakeDecoratorTest.js +27 -0
- package/build/__tests__/support/EventFaker.d.ts +5 -0
- package/build/__tests__/support/EventFaker.js +36 -0
- package/build/__tests__/support/FakeThemeManager.d.ts +8 -0
- package/build/__tests__/support/FakeThemeManager.js +40 -0
- package/build/__tests__/test.types.d.ts +2 -0
- package/build/__tests__/test.types.js +2 -0
- package/build/__tests__/testDirsAndFiles/one-good-store-skill/build/.spruce/stores/stores.d.ts +5 -0
- package/build/__tests__/testDirsAndFiles/one-good-store-skill/build/.spruce/stores/stores.js +9 -0
- package/build/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.d.ts +51 -0
- package/build/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.js +33 -0
- package/build/__tests__/testDirsAndFiles/one-good-store-skill/src/.spruce/settings.json +6 -0
- package/build/__tests__/testDirsAndFiles/skill/build/.spruce/views/views.js +18 -0
- package/build/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Book.svc.d.ts +5 -0
- package/build/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Book.svc.js +11 -0
- package/build/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.d.ts +7 -0
- package/build/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.js +19 -0
- package/build/__tests__/testDirsAndFiles/skill/build/viewControllers/BookForm.vc.d.ts +8 -0
- package/build/__tests__/testDirsAndFiles/skill/build/viewControllers/BookForm.vc.js +31 -0
- package/build/__tests__/testDirsAndFiles/skill/package.json +5 -0
- package/build/__tests__/testDirsAndFiles/skill/src/.spruce/settings.json +6 -0
- package/build/__tests__/testDirsAndFiles/skill/src/.spruce/views/views.d.ts +7 -0
- package/build/__tests__/testDirsAndFiles/skill/src/.spruce/views/views.js +16 -0
- package/build/__tests__/testDirsAndFiles/skill/src/skillViewControllers/Book.svc.d.ts +5 -0
- package/build/__tests__/testDirsAndFiles/skill/src/skillViewControllers/Book.svc.js +11 -0
- package/build/__tests__/testDirsAndFiles/skill/src/viewControllers/BookForm.vc.d.ts +8 -0
- package/build/__tests__/testDirsAndFiles/skill/src/viewControllers/BookForm.vc.js +31 -0
- package/build/esm/__tests__/behavioral/CanUseStoresSetupInBeforeEach.test.d.ts +7 -0
- package/build/esm/__tests__/behavioral/CanUseStoresSetupInBeforeEach.test.js +53 -0
- package/build/esm/__tests__/behavioral/DatabaseFixture.test.d.ts +7 -0
- package/build/esm/__tests__/behavioral/DatabaseFixture.test.js +48 -0
- package/build/esm/__tests__/behavioral/DbResetsAsExpected.test.d.ts +5 -0
- package/build/esm/__tests__/behavioral/DbResetsAsExpected.test.js +28 -0
- package/build/esm/__tests__/behavioral/DecoratoringEmitToPassThroughProxy.test.d.ts +15 -0
- package/build/esm/__tests__/behavioral/DecoratoringEmitToPassThroughProxy.test.js +125 -0
- package/build/esm/__tests__/behavioral/DelaysConnectWhenOnlyUsingLoginDecorator.test.d.ts +4 -0
- package/build/esm/__tests__/behavioral/DelaysConnectWhenOnlyUsingLoginDecorator.test.js +40 -0
- package/build/esm/__tests__/behavioral/DisablingSchemaValidationOnTest.test.d.ts +5 -0
- package/build/esm/__tests__/behavioral/DisablingSchemaValidationOnTest.test.js +23 -0
- package/build/esm/__tests__/behavioral/DoesntResetAccountIfOnlySeedingLocally.test.d.ts +8 -0
- package/build/esm/__tests__/behavioral/DoesntResetAccountIfOnlySeedingLocally.test.js +76 -0
- package/build/esm/__tests__/behavioral/DummyStore.d.ts +55 -0
- package/build/esm/__tests__/behavioral/DummyStore.js +43 -0
- package/build/esm/__tests__/behavioral/FakingEventResponses.test.d.ts +12 -0
- package/build/esm/__tests__/behavioral/FakingEventResponses.test.js +147 -0
- package/build/esm/__tests__/behavioral/FixtureFactory.test.d.ts +7 -0
- package/build/esm/__tests__/behavioral/FixtureFactory.test.js +61 -0
- package/build/esm/__tests__/behavioral/LocationFixture.test.d.ts +15 -0
- package/build/esm/__tests__/behavioral/LocationFixture.test.js +153 -0
- package/build/esm/__tests__/behavioral/LoginDecoratorHandlingProxiesForMe.test.d.ts +12 -0
- package/build/esm/__tests__/behavioral/LoginDecoratorHandlingProxiesForMe.test.js +110 -0
- package/build/esm/__tests__/behavioral/MakingSureLocalEventsAreHandledLocally.test.d.ts +4 -0
- package/build/esm/__tests__/behavioral/MakingSureLocalEventsAreHandledLocally.test.js +38 -0
- package/build/esm/__tests__/behavioral/MercuryFixture.test.d.ts +19 -0
- package/build/esm/__tests__/behavioral/MercuryFixture.test.js +209 -0
- package/build/esm/__tests__/behavioral/OrganizationFixture.test.d.ts +31 -0
- package/build/esm/__tests__/behavioral/OrganizationFixture.test.js +387 -0
- package/build/esm/__tests__/behavioral/PatchingConsoleErrorToErrorStream.test.d.ts +4 -0
- package/build/esm/__tests__/behavioral/PatchingConsoleErrorToErrorStream.test.js +18 -0
- package/build/esm/__tests__/behavioral/PersonFixture.test.d.ts +22 -0
- package/build/esm/__tests__/behavioral/PersonFixture.test.js +231 -0
- package/build/esm/__tests__/behavioral/PhoneNumberIncrementor.test.d.ts +11 -0
- package/build/esm/__tests__/behavioral/PhoneNumberIncrementor.test.js +112 -0
- package/build/esm/__tests__/behavioral/ResettingAccountLocationsInBeforeAll.test.d.ts +8 -0
- package/build/esm/__tests__/behavioral/ResettingAccountLocationsInBeforeAll.test.js +80 -0
- package/build/esm/__tests__/behavioral/ResettingAccountOrgsInAfterAll.test.d.ts +5 -0
- package/build/esm/__tests__/behavioral/ResettingAccountOrgsInAfterAll.test.js +51 -0
- package/build/esm/__tests__/behavioral/ResettingAccountOrgsInBeforeAll.test.d.ts +7 -0
- package/build/esm/__tests__/behavioral/ResettingAccountOrgsInBeforeAll.test.js +59 -0
- package/build/esm/__tests__/behavioral/ResettingFixtureFieldsBeforeEach.test.d.ts +10 -0
- package/build/esm/__tests__/behavioral/ResettingFixtureFieldsBeforeEach.test.js +139 -0
- package/build/esm/__tests__/behavioral/ResettingLocalEventListeningBeforeSeeding.test.d.ts +7 -0
- package/build/esm/__tests__/behavioral/ResettingLocalEventListeningBeforeSeeding.test.js +57 -0
- package/build/esm/__tests__/behavioral/RetainsContractWhenLoggingInUsingDecotorator.test.d.ts +6 -0
- package/build/esm/__tests__/behavioral/RetainsContractWhenLoggingInUsingDecotorator.test.js +48 -0
- package/build/esm/__tests__/behavioral/RoleFixture.test.d.ts +15 -0
- package/build/esm/__tests__/behavioral/RoleFixture.test.js +143 -0
- package/build/esm/__tests__/behavioral/SeedingData.test.d.ts +24 -0
- package/build/esm/__tests__/behavioral/SeedingData.test.js +314 -0
- package/build/esm/__tests__/behavioral/SkillFixture.test.d.ts +13 -0
- package/build/esm/__tests__/behavioral/SkillFixture.test.js +139 -0
- package/build/esm/__tests__/behavioral/StoreFixture.test.d.ts +23 -0
- package/build/esm/__tests__/behavioral/StoreFixture.test.js +164 -0
- package/build/esm/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.d.ts +9 -0
- package/build/esm/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.js +87 -0
- package/build/esm/__tests__/behavioral/faking/FakeDecorator.test.d.ts +45 -0
- package/build/esm/__tests__/behavioral/faking/FakeDecorator.test.js +479 -0
- package/build/esm/__tests__/behavioral/faking/FakeDecoratorSetsPerson.test.d.ts +4 -0
- package/build/esm/__tests__/behavioral/faking/FakeDecoratorSetsPerson.test.js +28 -0
- package/build/esm/__tests__/behavioral/faking/FakeDecoratorWhoAmI.test.d.ts +4 -0
- package/build/esm/__tests__/behavioral/faking/FakeDecoratorWhoAmI.test.js +32 -0
- package/build/esm/__tests__/behavioral/faking/FakeThemeManager.test.d.ts +8 -0
- package/build/esm/__tests__/behavioral/faking/FakeThemeManager.test.js +82 -0
- package/build/esm/__tests__/behavioral/faking/FakingAddingPeopleToALocation.test.d.ts +8 -0
- package/build/esm/__tests__/behavioral/faking/FakingAddingPeopleToALocation.test.js +70 -0
- package/build/esm/__tests__/behavioral/faking/FakingAddingPeopleToAnOrg.test.d.ts +14 -0
- package/build/esm/__tests__/behavioral/faking/FakingAddingPeopleToAnOrg.test.js +165 -0
- package/build/esm/__tests__/behavioral/faking/FakingInBeforeEach.test.d.ts +6 -0
- package/build/esm/__tests__/behavioral/faking/FakingInBeforeEach.test.js +55 -0
- package/build/esm/__tests__/behavioral/faking/FakingRoleEvents.test.d.ts +19 -0
- package/build/esm/__tests__/behavioral/faking/FakingRoleEvents.test.js +175 -0
- package/build/esm/__tests__/behavioral/faking/FakingSkillEvents.test.d.ts +24 -0
- package/build/esm/__tests__/behavioral/faking/FakingSkillEvents.test.js +214 -0
- package/build/esm/__tests__/behavioral/faking/UpdatePerson.test.d.ts +4 -0
- package/build/esm/__tests__/behavioral/faking/UpdatePerson.test.js +38 -0
- package/build/esm/__tests__/behavioral/faking/UsingFakeDecorators.test.d.ts +35 -0
- package/build/esm/__tests__/behavioral/faking/UsingFakeDecorators.test.js +360 -0
- package/build/esm/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.d.ts +4 -0
- package/build/esm/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.js +31 -0
- package/build/esm/__tests__/behavioral/faking/WhoAmI.test.d.ts +19 -0
- package/build/esm/__tests__/behavioral/faking/WhoAmI.test.js +140 -0
- package/build/esm/__tests__/behavioral/maps/SpyingMapUtil.test.d.ts +10 -0
- package/build/esm/__tests__/behavioral/maps/SpyingMapUtil.test.js +94 -0
- package/build/esm/__tests__/behavioral/seeding/UsingDecorators.test.d.ts +37 -0
- package/build/esm/__tests__/behavioral/seeding/UsingDecorators.test.js +322 -0
- package/build/esm/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.d.ts +14 -0
- package/build/esm/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.js +134 -0
- package/build/esm/__tests__/behavioral/views/CheckingPermissions.test.d.ts +24 -0
- package/build/esm/__tests__/behavioral/views/CheckingPermissions.test.js +200 -0
- package/build/esm/__tests__/behavioral/views/FakingSkillViewControllers.test.d.ts +12 -0
- package/build/esm/__tests__/behavioral/views/FakingSkillViewControllers.test.js +69 -0
- package/build/esm/__tests__/behavioral/views/Routing.test.d.ts +31 -0
- package/build/esm/__tests__/behavioral/views/Routing.test.js +169 -0
- package/build/esm/__tests__/behavioral/views/TestingScope.test.d.ts +9 -0
- package/build/esm/__tests__/behavioral/views/TestingScope.test.js +84 -0
- package/build/esm/__tests__/behavioral/views/ViewFixture.test.d.ts +102 -0
- package/build/esm/__tests__/behavioral/views/ViewFixture.test.js +731 -0
- package/build/esm/__tests__/behavioral/views/WorkingWithTimezones.test.d.ts +11 -0
- package/build/esm/__tests__/behavioral/views/WorkingWithTimezones.test.js +63 -0
- package/build/esm/__tests__/support/AbstractFakeDecoratorTest.d.ts +5 -0
- package/build/esm/__tests__/support/AbstractFakeDecoratorTest.js +34 -0
- package/build/esm/__tests__/support/EventFaker.d.ts +5 -0
- package/build/esm/__tests__/support/EventFaker.js +45 -0
- package/build/esm/__tests__/support/FakeThemeManager.d.ts +8 -0
- package/build/esm/__tests__/support/FakeThemeManager.js +37 -0
- package/build/esm/__tests__/test.types.d.ts +2 -0
- package/build/esm/__tests__/test.types.js +1 -0
- package/build/esm/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.d.ts +51 -0
- package/build/esm/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.js +41 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Book.svc.d.ts +5 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Book.svc.js +8 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.d.ts +7 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.js +27 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/viewControllers/BookForm.vc.d.ts +8 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/build/viewControllers/BookForm.vc.js +25 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/src/skillViewControllers/Book.svc.d.ts +5 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/src/skillViewControllers/Book.svc.js +8 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/src/viewControllers/BookForm.vc.d.ts +8 -0
- package/build/esm/__tests__/testDirsAndFiles/skill/src/viewControllers/BookForm.vc.js +25 -0
- package/build/esm/index.d.ts +1 -0
- package/build/esm/index.js +1 -0
- package/build/esm/tests/fixtures/ViewFixture.d.ts +1 -0
- package/build/esm/tests/fixtures/ViewFixture.js +4 -1
- package/build/esm/tests/routers/TestRouter.d.ts +3 -0
- package/build/esm/tests/routers/TestRouter.js +6 -0
- package/build/esm/utilities/vcDisk.utility.js +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +3 -1
- package/build/tests/fixtures/ViewFixture.d.ts +1 -0
- package/build/tests/fixtures/ViewFixture.js +4 -1
- package/build/tests/routers/TestRouter.d.ts +3 -0
- package/build/tests/routers/TestRouter.js +6 -0
- package/build/utilities/vcDisk.utility.js +1 -0
- package/package.json +19 -19
|
@@ -0,0 +1,134 @@
|
|
|
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 { assert, test } from '@sprucelabs/test';
|
|
17
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest.js';
|
|
18
|
+
import { DEMO_NUMBER_SKILL_DECORATORS } from '../../../tests/constants.js';
|
|
19
|
+
import install from '../../../tests/decorators/install.js';
|
|
20
|
+
import login from '../../../tests/decorators/login.js';
|
|
21
|
+
import seed from '../../../tests/decorators/seed.js';
|
|
22
|
+
let UsingDecoratorsToInstallSkills = class UsingDecoratorsToInstallSkills extends AbstractSpruceFixtureTest {
|
|
23
|
+
static beforeEach() {
|
|
24
|
+
const _super = Object.create(null, {
|
|
25
|
+
beforeEach: { get: () => super.beforeEach }
|
|
26
|
+
});
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
yield _super.beforeEach.call(this);
|
|
29
|
+
this.skill = yield this.skills.seedDemoSkill();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
static throwsWhenMissingNamespaces() {
|
|
33
|
+
assert.doesThrow(() => install.skills());
|
|
34
|
+
}
|
|
35
|
+
static returnsDecorator() {
|
|
36
|
+
const decorator = this.getDecorator();
|
|
37
|
+
assert.isFunction(decorator);
|
|
38
|
+
}
|
|
39
|
+
static callsOriginalTestMethod() {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
let wasHit = false;
|
|
42
|
+
yield this.executeDecorator({
|
|
43
|
+
testFunction: () => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
wasHit = true;
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
assert.isTrue(wasHit);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
static passesThroughOriginalArgs(args) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
let passedArgs;
|
|
53
|
+
yield this.executeDecorator({
|
|
54
|
+
testFunction: (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
passedArgs = args;
|
|
56
|
+
}),
|
|
57
|
+
args,
|
|
58
|
+
});
|
|
59
|
+
assert.isEqualDeep(passedArgs, args);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
static throwsWithoutSeedingOrg() {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
yield assert.doesThrowAsync(() => this.executeDecorator({ testFunction: () => __awaiter(this, void 0, void 0, function* () { }) }));
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
static throwsWhenInstallingBadSkill() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
yield assert.doesThrowAsync(() => this.executeDecorator({
|
|
70
|
+
testFunction: () => __awaiter(this, void 0, void 0, function* () { }),
|
|
71
|
+
namespaces: ['not-found'],
|
|
72
|
+
}));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
static doesNotEmitDidInstall() {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
let passedPayload;
|
|
78
|
+
yield login.getClient().on('install-skill::v2020_12_25', ({ payload }) => {
|
|
79
|
+
passedPayload = payload;
|
|
80
|
+
return {};
|
|
81
|
+
});
|
|
82
|
+
yield this.executeDecorator({
|
|
83
|
+
testFunction: () => __awaiter(this, void 0, void 0, function* () { }),
|
|
84
|
+
});
|
|
85
|
+
assert.isFalse(passedPayload.shouldNotifySkillOfInstall);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
static executeDecorator(options) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const { testFunction, args, namespaces } = options;
|
|
91
|
+
const mockDescriptor = {
|
|
92
|
+
value: testFunction,
|
|
93
|
+
};
|
|
94
|
+
const decorator = this.getDecorator(namespaces);
|
|
95
|
+
decorator(this, 'myTest', mockDescriptor);
|
|
96
|
+
//@ts-ignore
|
|
97
|
+
yield mockDescriptor.value(...(args ? args : []));
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
static getDecorator(namespaces) {
|
|
101
|
+
const slugs = namespaces !== null && namespaces !== void 0 ? namespaces : [this.skill.slug];
|
|
102
|
+
return install.skills(...slugs);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
__decorate([
|
|
106
|
+
test()
|
|
107
|
+
], UsingDecoratorsToInstallSkills, "throwsWhenMissingNamespaces", null);
|
|
108
|
+
__decorate([
|
|
109
|
+
test()
|
|
110
|
+
], UsingDecoratorsToInstallSkills, "returnsDecorator", null);
|
|
111
|
+
__decorate([
|
|
112
|
+
test(),
|
|
113
|
+
seed('organizations', 1)
|
|
114
|
+
], UsingDecoratorsToInstallSkills, "callsOriginalTestMethod", null);
|
|
115
|
+
__decorate([
|
|
116
|
+
test('passes args 1', [1]),
|
|
117
|
+
test('passes args 1', ['hello', 'world']),
|
|
118
|
+
seed('organizations', 1)
|
|
119
|
+
], UsingDecoratorsToInstallSkills, "passesThroughOriginalArgs", null);
|
|
120
|
+
__decorate([
|
|
121
|
+
test()
|
|
122
|
+
], UsingDecoratorsToInstallSkills, "throwsWithoutSeedingOrg", null);
|
|
123
|
+
__decorate([
|
|
124
|
+
test(),
|
|
125
|
+
seed('organizations', 1)
|
|
126
|
+
], UsingDecoratorsToInstallSkills, "throwsWhenInstallingBadSkill", null);
|
|
127
|
+
__decorate([
|
|
128
|
+
test(),
|
|
129
|
+
seed('organizations', 1)
|
|
130
|
+
], UsingDecoratorsToInstallSkills, "doesNotEmitDidInstall", null);
|
|
131
|
+
UsingDecoratorsToInstallSkills = __decorate([
|
|
132
|
+
login(DEMO_NUMBER_SKILL_DECORATORS)
|
|
133
|
+
], UsingDecoratorsToInstallSkills);
|
|
134
|
+
export default UsingDecoratorsToInstallSkills;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
|
|
2
|
+
export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
|
|
3
|
+
private static contractId;
|
|
4
|
+
protected static beforeEach(): Promise<void>;
|
|
5
|
+
protected static canCreateCheckingPermissions(): Promise<void>;
|
|
6
|
+
protected static sharesInstances(): Promise<void>;
|
|
7
|
+
protected static viewsFixtureResetsInstance(): Promise<void>;
|
|
8
|
+
protected static throwsWhenMissingOnCan(): Promise<void>;
|
|
9
|
+
protected static throwsWhenNotSettingResponse(): Promise<void>;
|
|
10
|
+
protected static throwsWhenContractIdNotFaked(): Promise<void>;
|
|
11
|
+
protected static doesNotThrowWhenMatchingSecondContractId(): Promise<void>;
|
|
12
|
+
protected static throwsWhenNotFindingPermissionId(): Promise<void>;
|
|
13
|
+
protected static throwsWhenFindingLaterMissingPermId(): Promise<void>;
|
|
14
|
+
protected static returnsFakedResponses(permissionIds: string[], can: boolean): Promise<void>;
|
|
15
|
+
protected static fixtureAndLoadOptionsShareAuthorizer(): Promise<void>;
|
|
16
|
+
protected static authorizerClobbersMatchingContracts(): Promise<void>;
|
|
17
|
+
protected static canHandleMulplePermissionsWithDifferentContracts(): Promise<void>;
|
|
18
|
+
private static assertPermNotFound;
|
|
19
|
+
private static changeContractId;
|
|
20
|
+
private static assertThrowsFakeError;
|
|
21
|
+
private static fakePermissions;
|
|
22
|
+
private static can;
|
|
23
|
+
private static getInstance;
|
|
24
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
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 { test, assert } from '@sprucelabs/test';
|
|
17
|
+
import { errorAssert, generateId } from '@sprucelabs/test-utils';
|
|
18
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest.js';
|
|
19
|
+
import ViewFixture from '../../../tests/fixtures/ViewFixture.js';
|
|
20
|
+
import SpyAuthorizer from '../../../tests/SpyAuthorizer.js';
|
|
21
|
+
export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
|
|
22
|
+
static beforeEach() {
|
|
23
|
+
const _super = Object.create(null, {
|
|
24
|
+
beforeEach: { get: () => super.beforeEach }
|
|
25
|
+
});
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
yield _super.beforeEach.call(this);
|
|
28
|
+
this.contractId = generateId();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
static canCreateCheckingPermissions() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const instance = CheckingPermissionsTest.getInstance();
|
|
34
|
+
assert.isTrue(instance instanceof SpyAuthorizer);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
static sharesInstances() {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
assert.isEqual(this.getInstance(), this.getInstance());
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
static viewsFixtureResetsInstance() {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const instance = this.getInstance();
|
|
45
|
+
yield ViewFixture.beforeEach();
|
|
46
|
+
assert.isNotEqual(this.getInstance(), instance);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
static throwsWhenMissingOnCan() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const err = yield assert.doesThrowAsync(() =>
|
|
52
|
+
//@ts-ignore
|
|
53
|
+
this.getInstance().can());
|
|
54
|
+
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
55
|
+
parameters: ['contractId', 'permissionIds'],
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
static throwsWhenNotSettingResponse() {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
yield this.assertThrowsFakeError();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
static throwsWhenContractIdNotFaked() {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
this.fakePermissions([{ id: 'test', can: true }]);
|
|
67
|
+
this.changeContractId();
|
|
68
|
+
yield this.assertThrowsFakeError();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
static doesNotThrowWhenMatchingSecondContractId() {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
this.fakePermissions([{ id: 'test', can: true }]);
|
|
74
|
+
this.changeContractId();
|
|
75
|
+
this.fakePermissions([{ id: 'test2', can: true }]);
|
|
76
|
+
yield this.can(['test2']);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
static throwsWhenNotFindingPermissionId() {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
this.fakePermissions([{ id: 'test', can: true }]);
|
|
82
|
+
yield this.assertPermNotFound(['test2'], 'test2');
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
static throwsWhenFindingLaterMissingPermId() {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
this.fakePermissions([{ id: 'test', can: true }]);
|
|
88
|
+
yield this.assertPermNotFound(['test', 'test2'], 'test2');
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
static returnsFakedResponses(permissionIds, can) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const faked = [];
|
|
94
|
+
const expected = {};
|
|
95
|
+
permissionIds.forEach((id) => ((expected[id] = can), faked.push({ id, can })));
|
|
96
|
+
this.fakePermissions(faked);
|
|
97
|
+
const results = yield this.can(permissionIds);
|
|
98
|
+
assert.isEqualDeep(results, expected);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
static fixtureAndLoadOptionsShareAuthorizer() {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
this.views = this.Fixture('view', {
|
|
104
|
+
controllerMap: {},
|
|
105
|
+
});
|
|
106
|
+
const auth = this.views.getAuthorizer();
|
|
107
|
+
const router = this.views.getRouter();
|
|
108
|
+
assert.isEqual(auth, router.buildLoadOptions().authorizer);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
static authorizerClobbersMatchingContracts() {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
this.fakePermissions([{ id: 'test', can: true }]);
|
|
114
|
+
this.fakePermissions([{ id: 'test', can: false }]);
|
|
115
|
+
const perms = yield this.can(['test']);
|
|
116
|
+
assert.isFalse(perms['test']);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
static canHandleMulplePermissionsWithDifferentContracts() {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const firstId = this.contractId;
|
|
122
|
+
this.fakePermissions([{ id: 'test', can: true }]);
|
|
123
|
+
this.changeContractId();
|
|
124
|
+
this.fakePermissions([{ id: 'test', can: false }]);
|
|
125
|
+
this.contractId = firstId;
|
|
126
|
+
const perms = yield this.can(['test']);
|
|
127
|
+
assert.isTrue(perms['test']);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
static assertPermNotFound(checkIds, id) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
yield assert.doesThrowAsync(() => this.can(checkIds), id);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
static changeContractId() {
|
|
136
|
+
this.contractId = generateId();
|
|
137
|
+
}
|
|
138
|
+
static assertThrowsFakeError() {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
yield assert.doesThrowAsync(() => this.can(['test']), `Contract by the id '${this.contractId}'`);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
static fakePermissions(faked) {
|
|
144
|
+
this.getInstance().fakePermissions({
|
|
145
|
+
contractId: this.contractId,
|
|
146
|
+
permissions: faked,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
static can(permissionIds) {
|
|
150
|
+
return this.getInstance().can({
|
|
151
|
+
contractId: this.contractId,
|
|
152
|
+
permissionIds,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
static getInstance() {
|
|
156
|
+
return SpyAuthorizer.getInstance();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
__decorate([
|
|
160
|
+
test()
|
|
161
|
+
], CheckingPermissionsTest, "canCreateCheckingPermissions", null);
|
|
162
|
+
__decorate([
|
|
163
|
+
test()
|
|
164
|
+
], CheckingPermissionsTest, "sharesInstances", null);
|
|
165
|
+
__decorate([
|
|
166
|
+
test()
|
|
167
|
+
], CheckingPermissionsTest, "viewsFixtureResetsInstance", null);
|
|
168
|
+
__decorate([
|
|
169
|
+
test()
|
|
170
|
+
], CheckingPermissionsTest, "throwsWhenMissingOnCan", null);
|
|
171
|
+
__decorate([
|
|
172
|
+
test()
|
|
173
|
+
], CheckingPermissionsTest, "throwsWhenNotSettingResponse", null);
|
|
174
|
+
__decorate([
|
|
175
|
+
test()
|
|
176
|
+
], CheckingPermissionsTest, "throwsWhenContractIdNotFaked", null);
|
|
177
|
+
__decorate([
|
|
178
|
+
test()
|
|
179
|
+
], CheckingPermissionsTest, "doesNotThrowWhenMatchingSecondContractId", null);
|
|
180
|
+
__decorate([
|
|
181
|
+
test()
|
|
182
|
+
], CheckingPermissionsTest, "throwsWhenNotFindingPermissionId", null);
|
|
183
|
+
__decorate([
|
|
184
|
+
test()
|
|
185
|
+
], CheckingPermissionsTest, "throwsWhenFindingLaterMissingPermId", null);
|
|
186
|
+
__decorate([
|
|
187
|
+
test('returns false on can 1', ['first', 'second', 'third'], false),
|
|
188
|
+
test('returns false on can 2', ['third', 'fourth'], false),
|
|
189
|
+
test('returns false on can 3', ['first', 'second', 'third'], true),
|
|
190
|
+
test('returns false on can 4', ['third', 'fourth'], true)
|
|
191
|
+
], CheckingPermissionsTest, "returnsFakedResponses", null);
|
|
192
|
+
__decorate([
|
|
193
|
+
test()
|
|
194
|
+
], CheckingPermissionsTest, "fixtureAndLoadOptionsShareAuthorizer", null);
|
|
195
|
+
__decorate([
|
|
196
|
+
test()
|
|
197
|
+
], CheckingPermissionsTest, "authorizerClobbersMatchingContracts", null);
|
|
198
|
+
__decorate([
|
|
199
|
+
test()
|
|
200
|
+
], CheckingPermissionsTest, "canHandleMulplePermissionsWithDifferentContracts", null);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
|
|
2
|
+
import FakeSkillViewController from '../../../tests/Fake.svc';
|
|
3
|
+
export default class FakingSkillViewControllersTest extends AbstractSpruceFixtureTest {
|
|
4
|
+
protected static controllerMap: {
|
|
5
|
+
fake: typeof FakeSkillViewController;
|
|
6
|
+
};
|
|
7
|
+
private static viewFixture;
|
|
8
|
+
protected static beforeEach(): Promise<void>;
|
|
9
|
+
protected static canRenderkFakeSkillViewController(): Promise<void>;
|
|
10
|
+
protected static passesThroughConstructorAptions(options: any): Promise<void>;
|
|
11
|
+
protected static passesThroughLoadArgs(args: any): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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 { skillViewSchema } from '@sprucelabs/heartwood-view-controllers';
|
|
17
|
+
import { validateSchemaValues } from '@sprucelabs/schema';
|
|
18
|
+
import { assert, test } from '@sprucelabs/test';
|
|
19
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest.js';
|
|
20
|
+
import FakeSkillViewController from '../../../tests/Fake.svc.js';
|
|
21
|
+
export default class FakingSkillViewControllersTest extends AbstractSpruceFixtureTest {
|
|
22
|
+
static beforeEach() {
|
|
23
|
+
const _super = Object.create(null, {
|
|
24
|
+
beforeEach: { get: () => super.beforeEach }
|
|
25
|
+
});
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
yield _super.beforeEach.call(this);
|
|
28
|
+
this.viewFixture = this.Fixture('view', {
|
|
29
|
+
controllerMap: {
|
|
30
|
+
fake: FakeSkillViewController,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
static canRenderkFakeSkillViewController() {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const vc = this.viewFixture.Controller('fake', {});
|
|
38
|
+
const model = this.viewFixture.render(vc);
|
|
39
|
+
validateSchemaValues(skillViewSchema, model);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
static passesThroughConstructorAptions(options) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const vc = this.viewFixture.Controller('fake', options);
|
|
45
|
+
assert.doesInclude(vc.constructorOptions, options);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
static passesThroughLoadArgs(args) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const vc = this.viewFixture.Controller('fake', {});
|
|
51
|
+
yield this.viewFixture.load(vc, args);
|
|
52
|
+
assert.isEqualDeep(vc.args, args);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
FakingSkillViewControllersTest.controllerMap = {
|
|
57
|
+
fake: FakeSkillViewController,
|
|
58
|
+
};
|
|
59
|
+
__decorate([
|
|
60
|
+
test()
|
|
61
|
+
], FakingSkillViewControllersTest, "canRenderkFakeSkillViewController", null);
|
|
62
|
+
__decorate([
|
|
63
|
+
test('passed constructor options 1', { hello: 'world' }),
|
|
64
|
+
test('passed constructor options 2', { taco: 'bell' })
|
|
65
|
+
], FakingSkillViewControllersTest, "passesThroughConstructorAptions", null);
|
|
66
|
+
__decorate([
|
|
67
|
+
test('passes args 1', { hello: 'world' }),
|
|
68
|
+
test('passes args 2', { cheesey: 'burrito' })
|
|
69
|
+
], FakingSkillViewControllersTest, "passesThroughLoadArgs", null);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SkillViewControllerId } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
|
|
3
|
+
import BookSkillViewController from '../../testDirsAndFiles/skill/build/skillViewControllers/Book.svc';
|
|
4
|
+
import SpySkillViewController from '../../testDirsAndFiles/skill/build/skillViewControllers/Spy.svc';
|
|
5
|
+
declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.types' {
|
|
6
|
+
interface ViewControllerMap {
|
|
7
|
+
'spruceTestFixtures.book': BookSkillViewController;
|
|
8
|
+
'spruceTestFixtures.spy': SpySkillViewController;
|
|
9
|
+
}
|
|
10
|
+
interface SkillViewControllerMap {
|
|
11
|
+
'spruceTestFixtures.book': BookSkillViewController;
|
|
12
|
+
'spruceTestFixtures.spy': SpySkillViewController;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export default class RoutingTest extends AbstractSpruceFixtureTest {
|
|
16
|
+
private static router;
|
|
17
|
+
private static factory;
|
|
18
|
+
protected static vcDir: string;
|
|
19
|
+
protected static beforeEach(): Promise<void>;
|
|
20
|
+
protected static throwsWithBadDestination(): Promise<void>;
|
|
21
|
+
protected static getPresentVcIsEmptyToStart(): Promise<void>;
|
|
22
|
+
protected static canRedirectToGoodSvcWithoutNamespace(id: SkillViewControllerId, Vc: any): Promise<void>;
|
|
23
|
+
protected static redirectTriggersLoadWithExpectedItems(args: any): Promise<void>;
|
|
24
|
+
protected static redirectByDefaultDoesNotLoadWithExpectedItems(args: any): Promise<void>;
|
|
25
|
+
protected static canHookIntoRedirectEvents(expectedArgs: any): Promise<void>;
|
|
26
|
+
protected static canFakeRedirectToHeartwoodRoot(): Promise<void>;
|
|
27
|
+
protected static canSuppressBadControllerIdOnRedirect(): Promise<void>;
|
|
28
|
+
protected static shouldThrowWithBadSvcBecauseTestRouterIsReset(): Promise<void>;
|
|
29
|
+
protected static testRouterBuildsOptionsWithLocaleAndAuthorizer(): void;
|
|
30
|
+
private static assertRedirects;
|
|
31
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
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
|
+
/* eslint-disable spruce/prohibit-import-from-build-folder */
|
|
17
|
+
import { LocaleImpl } from '@sprucelabs/calendar-utils';
|
|
18
|
+
import { vcAssert, } from '@sprucelabs/heartwood-view-controllers';
|
|
19
|
+
import { diskUtil } from '@sprucelabs/spruce-skill-utils';
|
|
20
|
+
import { test, assert } from '@sprucelabs/test';
|
|
21
|
+
import { errorAssert } from '@sprucelabs/test-utils';
|
|
22
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest.js';
|
|
23
|
+
import FakeSkillViewController from '../../../tests/Fake.svc.js';
|
|
24
|
+
import TestRouter from '../../../tests/routers/TestRouter.js';
|
|
25
|
+
import SpyAuthorizer from '../../../tests/SpyAuthorizer.js';
|
|
26
|
+
import BookSkillViewController from '../../testDirsAndFiles/skill/build/skillViewControllers/Book.svc.js';
|
|
27
|
+
import SpySkillViewController from '../../testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.js';
|
|
28
|
+
export default class RoutingTest extends AbstractSpruceFixtureTest {
|
|
29
|
+
static beforeEach() {
|
|
30
|
+
const _super = Object.create(null, {
|
|
31
|
+
beforeEach: { get: () => super.beforeEach }
|
|
32
|
+
});
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
yield _super.beforeEach.call(this);
|
|
35
|
+
const fixture = this.Fixture('view', { vcDir: this.vcDir });
|
|
36
|
+
this.router = fixture.getRouter();
|
|
37
|
+
this.factory = fixture.getFactory();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
static throwsWithBadDestination() {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const err = yield assert.doesThrowAsync(() =>
|
|
43
|
+
//@ts-ignore
|
|
44
|
+
this.assertRedirects(() => this.router.redirect('waka.waka')));
|
|
45
|
+
errorAssert.assertError(err, 'INVALID_VIEW_CONTROLLER_NAME', {
|
|
46
|
+
name: 'waka.waka',
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
static getPresentVcIsEmptyToStart() {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
assert.isFalsy(this.router.getPresentVc());
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
static canRedirectToGoodSvcWithoutNamespace(id, Vc) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
yield this.assertRedirects(() => this.router.redirect(id, {}));
|
|
58
|
+
const vc = this.router.getPresentVc();
|
|
59
|
+
assert.isTrue(vc instanceof Vc);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
static redirectTriggersLoadWithExpectedItems(args) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
TestRouter.setShouldLoadDestinationVc(false);
|
|
65
|
+
//@ts-ignore
|
|
66
|
+
const vc = yield this.assertRedirects(() => this.router.redirect('spruceTestFixtures.spy', args));
|
|
67
|
+
const lastLoad = vc.loads.pop();
|
|
68
|
+
assert.isFalsy(lastLoad);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
static redirectByDefaultDoesNotLoadWithExpectedItems(args) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
//@ts-ignore
|
|
74
|
+
const vc = yield this.assertRedirects(() => this.router.redirect('spruceTestFixtures.spy', args));
|
|
75
|
+
const lastLoad = vc.loads.pop();
|
|
76
|
+
assert.isFalsy(lastLoad);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
static canHookIntoRedirectEvents(expectedArgs) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
let wasHit = false;
|
|
82
|
+
let passedId = '';
|
|
83
|
+
let passedVc = null;
|
|
84
|
+
let passedArgs = null;
|
|
85
|
+
yield this.router.on('did-redirect', ({ id, vc, args }) => {
|
|
86
|
+
wasHit = true;
|
|
87
|
+
passedId = id;
|
|
88
|
+
passedVc = vc;
|
|
89
|
+
passedArgs = args;
|
|
90
|
+
});
|
|
91
|
+
yield this.assertRedirects(() => this.router.redirect('spruceTestFixtures.book', expectedArgs));
|
|
92
|
+
assert.isTrue(wasHit);
|
|
93
|
+
assert.isEqual(passedId, 'spruceTestFixtures.book');
|
|
94
|
+
assert.isTruthy(passedVc);
|
|
95
|
+
assert.isTrue(passedVc instanceof BookSkillViewController);
|
|
96
|
+
assert.isEqualDeep(passedArgs, expectedArgs);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
static canFakeRedirectToHeartwoodRoot() {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
const svc = yield this.assertRedirects(() => this.router.redirect('heartwood.root'));
|
|
102
|
+
assert.isTrue(svc instanceof FakeSkillViewController);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
static canSuppressBadControllerIdOnRedirect() {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
TestRouter.setShouldThrowWhenRedirectingToBadSvc(false);
|
|
108
|
+
const id = `${new Date().getTime()}.root`;
|
|
109
|
+
//@ts-ignore
|
|
110
|
+
this.factory.setController(id, null);
|
|
111
|
+
yield this.assertRedirects(() => this.router.redirect(id));
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
static shouldThrowWithBadSvcBecauseTestRouterIsReset() {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
yield assert.doesThrowAsync(() =>
|
|
117
|
+
//@ts-ignore
|
|
118
|
+
this.router.redirect('waka.waka'));
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
static testRouterBuildsOptionsWithLocaleAndAuthorizer() {
|
|
122
|
+
const options = this.router.buildLoadOptions();
|
|
123
|
+
assert.isTrue(options.locale instanceof LocaleImpl);
|
|
124
|
+
assert.isTrue(options.authorizer instanceof SpyAuthorizer);
|
|
125
|
+
}
|
|
126
|
+
static assertRedirects(action) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
return vcAssert.assertActionRedirects({
|
|
129
|
+
action,
|
|
130
|
+
router: this.router,
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
RoutingTest.vcDir = diskUtil.resolvePath(__dirname, '..', '..', 'testDirsAndFiles', 'skill', 'build');
|
|
136
|
+
__decorate([
|
|
137
|
+
test()
|
|
138
|
+
], RoutingTest, "throwsWithBadDestination", null);
|
|
139
|
+
__decorate([
|
|
140
|
+
test()
|
|
141
|
+
], RoutingTest, "getPresentVcIsEmptyToStart", null);
|
|
142
|
+
__decorate([
|
|
143
|
+
test('can get book svc', 'spruceTestFixtures.book', BookSkillViewController),
|
|
144
|
+
test('can get spy svc', 'spruceTestFixtures.spy', SpySkillViewController)
|
|
145
|
+
], RoutingTest, "canRedirectToGoodSvcWithoutNamespace", null);
|
|
146
|
+
__decorate([
|
|
147
|
+
test('redirect calls load on destination vc if set 1', { hey: 'there' }),
|
|
148
|
+
test('redirect calls load on destination vc if set 2', { what: 'the!?' })
|
|
149
|
+
], RoutingTest, "redirectTriggersLoadWithExpectedItems", null);
|
|
150
|
+
__decorate([
|
|
151
|
+
test('redirect does not call load on destination vc 1', { hey: 'there' }),
|
|
152
|
+
test('redirect does not call load on destination vc 2', { what: 'the!?' })
|
|
153
|
+
], RoutingTest, "redirectByDefaultDoesNotLoadWithExpectedItems", null);
|
|
154
|
+
__decorate([
|
|
155
|
+
test('can hook into redirect no args', undefined),
|
|
156
|
+
test('can hook into redirect args 1', { taco: 'bell' })
|
|
157
|
+
], RoutingTest, "canHookIntoRedirectEvents", null);
|
|
158
|
+
__decorate([
|
|
159
|
+
test()
|
|
160
|
+
], RoutingTest, "canFakeRedirectToHeartwoodRoot", null);
|
|
161
|
+
__decorate([
|
|
162
|
+
test()
|
|
163
|
+
], RoutingTest, "canSuppressBadControllerIdOnRedirect", null);
|
|
164
|
+
__decorate([
|
|
165
|
+
test()
|
|
166
|
+
], RoutingTest, "shouldThrowWithBadSvcBecauseTestRouterIsReset", null);
|
|
167
|
+
__decorate([
|
|
168
|
+
test()
|
|
169
|
+
], RoutingTest, "testRouterBuildsOptionsWithLocaleAndAuthorizer", null);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
|
|
2
|
+
export default class TestingScopeTest extends AbstractSpruceFixtureTest {
|
|
3
|
+
private static scope;
|
|
4
|
+
protected static beforeEach(): Promise<void>;
|
|
5
|
+
protected static canResetScope(): Promise<void>;
|
|
6
|
+
protected static canSetCurrentOrgToNull(): Promise<void>;
|
|
7
|
+
protected static canSetCurrentLocationToNull(): Promise<void>;
|
|
8
|
+
protected static clearsLocationIdWhenSettingOrgId(): Promise<void>;
|
|
9
|
+
}
|