@sprucelabs/spruce-test-fixtures 45.2.7 → 46.0.0

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.
Files changed (269) hide show
  1. package/build/__tests__/behavioral/CanUseStoresSetupInBeforeEach.test.d.ts +7 -0
  2. package/build/__tests__/behavioral/CanUseStoresSetupInBeforeEach.test.js +41 -0
  3. package/build/__tests__/behavioral/DatabaseFixture.test.d.ts +7 -0
  4. package/build/__tests__/behavioral/DatabaseFixture.test.js +59 -0
  5. package/build/__tests__/behavioral/DbResetsAsExpected.test.d.ts +5 -0
  6. package/build/__tests__/behavioral/DbResetsAsExpected.test.js +34 -0
  7. package/build/__tests__/behavioral/DecoratoringEmitToPassThroughProxy.test.d.ts +15 -0
  8. package/build/__tests__/behavioral/DecoratoringEmitToPassThroughProxy.test.js +109 -0
  9. package/build/__tests__/behavioral/DelaysConnectWhenOnlyUsingLoginDecorator.test.d.ts +4 -0
  10. package/build/__tests__/behavioral/DelaysConnectWhenOnlyUsingLoginDecorator.test.js +34 -0
  11. package/build/__tests__/behavioral/DisablingSchemaValidationOnTest.test.d.ts +5 -0
  12. package/build/__tests__/behavioral/DisablingSchemaValidationOnTest.test.js +26 -0
  13. package/build/__tests__/behavioral/DoesntResetAccountIfOnlySeedingLocally.test.d.ts +8 -0
  14. package/build/__tests__/behavioral/DoesntResetAccountIfOnlySeedingLocally.test.js +65 -0
  15. package/build/__tests__/behavioral/DummyStore.d.ts +55 -0
  16. package/build/__tests__/behavioral/DummyStore.js +36 -0
  17. package/build/__tests__/behavioral/FakingEventResponses.test.d.ts +12 -0
  18. package/build/__tests__/behavioral/FakingEventResponses.test.js +125 -0
  19. package/build/__tests__/behavioral/FixtureFactory.test.d.ts +7 -0
  20. package/build/__tests__/behavioral/FixtureFactory.test.js +79 -0
  21. package/build/__tests__/behavioral/LocationFixture.test.d.ts +15 -0
  22. package/build/__tests__/behavioral/LocationFixture.test.js +128 -0
  23. package/build/__tests__/behavioral/LoginDecoratorHandlingProxiesForMe.test.d.ts +12 -0
  24. package/build/__tests__/behavioral/LoginDecoratorHandlingProxiesForMe.test.js +92 -0
  25. package/build/__tests__/behavioral/MakingSureLocalEventsAreHandledLocally.test.d.ts +4 -0
  26. package/build/__tests__/behavioral/MakingSureLocalEventsAreHandledLocally.test.js +29 -0
  27. package/build/__tests__/behavioral/MercuryFixture.test.d.ts +19 -0
  28. package/build/__tests__/behavioral/MercuryFixture.test.js +175 -0
  29. package/build/__tests__/behavioral/OrganizationFixture.test.d.ts +31 -0
  30. package/build/__tests__/behavioral/OrganizationFixture.test.js +331 -0
  31. package/build/__tests__/behavioral/PatchingConsoleErrorToErrorStream.test.d.ts +4 -0
  32. package/build/__tests__/behavioral/PatchingConsoleErrorToErrorStream.test.js +21 -0
  33. package/build/__tests__/behavioral/PersonFixture.test.d.ts +22 -0
  34. package/build/__tests__/behavioral/PersonFixture.test.js +224 -0
  35. package/build/__tests__/behavioral/PhoneNumberIncrementor.test.d.ts +11 -0
  36. package/build/__tests__/behavioral/PhoneNumberIncrementor.test.js +95 -0
  37. package/build/__tests__/behavioral/ResettingAccountLocationsInBeforeAll.test.d.ts +8 -0
  38. package/build/__tests__/behavioral/ResettingAccountLocationsInBeforeAll.test.js +60 -0
  39. package/build/__tests__/behavioral/ResettingAccountOrgsInAfterAll.test.d.ts +5 -0
  40. package/build/__tests__/behavioral/ResettingAccountOrgsInAfterAll.test.js +37 -0
  41. package/build/__tests__/behavioral/ResettingAccountOrgsInBeforeAll.test.d.ts +7 -0
  42. package/build/__tests__/behavioral/ResettingAccountOrgsInBeforeAll.test.js +44 -0
  43. package/build/__tests__/behavioral/ResettingFixtureFieldsBeforeEach.test.d.ts +10 -0
  44. package/build/__tests__/behavioral/ResettingFixtureFieldsBeforeEach.test.js +130 -0
  45. package/build/__tests__/behavioral/ResettingLocalEventListeningBeforeSeeding.test.d.ts +7 -0
  46. package/build/__tests__/behavioral/ResettingLocalEventListeningBeforeSeeding.test.js +42 -0
  47. package/build/__tests__/behavioral/RetainsContractWhenLoggingInUsingDecotorator.test.d.ts +6 -0
  48. package/build/__tests__/behavioral/RetainsContractWhenLoggingInUsingDecotorator.test.js +37 -0
  49. package/build/__tests__/behavioral/RoleFixture.test.d.ts +15 -0
  50. package/build/__tests__/behavioral/RoleFixture.test.js +118 -0
  51. package/build/__tests__/behavioral/SeedingData.test.d.ts +24 -0
  52. package/build/__tests__/behavioral/SeedingData.test.js +271 -0
  53. package/build/__tests__/behavioral/SkillFixture.test.d.ts +13 -0
  54. package/build/__tests__/behavioral/SkillFixture.test.js +116 -0
  55. package/build/__tests__/behavioral/StoreFixture.test.d.ts +23 -0
  56. package/build/__tests__/behavioral/StoreFixture.test.js +156 -0
  57. package/build/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.d.ts +9 -0
  58. package/build/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.js +71 -0
  59. package/build/__tests__/behavioral/faking/FakeDecorator.test.d.ts +45 -0
  60. package/build/__tests__/behavioral/faking/FakeDecorator.test.js +418 -0
  61. package/build/__tests__/behavioral/faking/FakeDecoratorSetsPerson.test.d.ts +4 -0
  62. package/build/__tests__/behavioral/faking/FakeDecoratorSetsPerson.test.js +23 -0
  63. package/build/__tests__/behavioral/faking/FakeDecoratorWhoAmI.test.d.ts +4 -0
  64. package/build/__tests__/behavioral/faking/FakeDecoratorWhoAmI.test.js +27 -0
  65. package/build/__tests__/behavioral/faking/FakeThemeManager.test.d.ts +8 -0
  66. package/build/__tests__/behavioral/faking/FakeThemeManager.test.js +93 -0
  67. package/build/__tests__/behavioral/faking/FakingAddingPeopleToALocation.test.d.ts +8 -0
  68. package/build/__tests__/behavioral/faking/FakingAddingPeopleToALocation.test.js +56 -0
  69. package/build/__tests__/behavioral/faking/FakingAddingPeopleToAnOrg.test.d.ts +14 -0
  70. package/build/__tests__/behavioral/faking/FakingAddingPeopleToAnOrg.test.js +141 -0
  71. package/build/__tests__/behavioral/faking/FakingInBeforeEach.test.d.ts +6 -0
  72. package/build/__tests__/behavioral/faking/FakingInBeforeEach.test.js +42 -0
  73. package/build/__tests__/behavioral/faking/FakingRoleEvents.test.d.ts +19 -0
  74. package/build/__tests__/behavioral/faking/FakingRoleEvents.test.js +140 -0
  75. package/build/__tests__/behavioral/faking/FakingSkillEvents.test.d.ts +24 -0
  76. package/build/__tests__/behavioral/faking/FakingSkillEvents.test.js +174 -0
  77. package/build/__tests__/behavioral/faking/UpdatePerson.test.d.ts +4 -0
  78. package/build/__tests__/behavioral/faking/UpdatePerson.test.js +32 -0
  79. package/build/__tests__/behavioral/faking/UsingFakeDecorators.test.d.ts +35 -0
  80. package/build/__tests__/behavioral/faking/UsingFakeDecorators.test.js +321 -0
  81. package/build/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.d.ts +4 -0
  82. package/build/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.js +48 -0
  83. package/build/__tests__/behavioral/faking/WhoAmI.test.d.ts +19 -0
  84. package/build/__tests__/behavioral/faking/WhoAmI.test.js +103 -0
  85. package/build/__tests__/behavioral/maps/SpyingMapUtil.test.d.ts +10 -0
  86. package/build/__tests__/behavioral/maps/SpyingMapUtil.test.js +76 -0
  87. package/build/__tests__/behavioral/seeding/UsingDecorators.test.d.ts +37 -0
  88. package/build/__tests__/behavioral/seeding/UsingDecorators.test.js +266 -0
  89. package/build/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.d.ts +14 -0
  90. package/build/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.js +113 -0
  91. package/build/__tests__/behavioral/views/CheckingPermissions.test.d.ts +24 -0
  92. package/build/__tests__/behavioral/views/CheckingPermissions.test.js +162 -0
  93. package/build/__tests__/behavioral/views/FakingSkillViewControllers.test.d.ts +12 -0
  94. package/build/__tests__/behavioral/views/FakingSkillViewControllers.test.js +55 -0
  95. package/build/__tests__/behavioral/views/Routing.test.d.ts +31 -0
  96. package/build/__tests__/behavioral/views/Routing.test.js +141 -0
  97. package/build/__tests__/behavioral/views/TestingScope.test.d.ts +9 -0
  98. package/build/__tests__/behavioral/views/TestingScope.test.js +67 -0
  99. package/build/__tests__/behavioral/views/ViewFixture.test.d.ts +102 -0
  100. package/build/__tests__/behavioral/views/ViewFixture.test.js +652 -0
  101. package/build/__tests__/behavioral/views/WorkingWithTimezones.test.d.ts +11 -0
  102. package/build/__tests__/behavioral/views/WorkingWithTimezones.test.js +55 -0
  103. package/build/__tests__/support/AbstractFakeDecoratorTest.d.ts +5 -0
  104. package/build/__tests__/support/AbstractFakeDecoratorTest.js +27 -0
  105. package/build/__tests__/support/EventFaker.d.ts +5 -0
  106. package/build/__tests__/support/EventFaker.js +36 -0
  107. package/build/__tests__/support/FakeThemeManager.d.ts +8 -0
  108. package/build/__tests__/support/FakeThemeManager.js +40 -0
  109. package/build/__tests__/test.types.d.ts +2 -0
  110. package/build/__tests__/test.types.js +2 -0
  111. package/build/__tests__/testDirsAndFiles/one-good-store-skill/build/.spruce/stores/stores.d.ts +5 -0
  112. package/build/__tests__/testDirsAndFiles/one-good-store-skill/build/.spruce/stores/stores.js +9 -0
  113. package/build/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.d.ts +51 -0
  114. package/build/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.js +33 -0
  115. package/build/__tests__/testDirsAndFiles/one-good-store-skill/src/.spruce/settings.json +6 -0
  116. package/build/__tests__/testDirsAndFiles/skill/build/.spruce/views/views.js +18 -0
  117. package/build/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Book.svc.d.ts +5 -0
  118. package/build/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Book.svc.js +11 -0
  119. package/build/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.d.ts +7 -0
  120. package/build/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.js +19 -0
  121. package/build/__tests__/testDirsAndFiles/skill/build/viewControllers/BookForm.vc.d.ts +8 -0
  122. package/build/__tests__/testDirsAndFiles/skill/build/viewControllers/BookForm.vc.js +31 -0
  123. package/build/__tests__/testDirsAndFiles/skill/package.json +5 -0
  124. package/build/__tests__/testDirsAndFiles/skill/src/.spruce/settings.json +6 -0
  125. package/build/__tests__/testDirsAndFiles/skill/src/.spruce/views/views.d.ts +7 -0
  126. package/build/__tests__/testDirsAndFiles/skill/src/.spruce/views/views.js +16 -0
  127. package/build/__tests__/testDirsAndFiles/skill/src/skillViewControllers/Book.svc.d.ts +5 -0
  128. package/build/__tests__/testDirsAndFiles/skill/src/skillViewControllers/Book.svc.js +11 -0
  129. package/build/__tests__/testDirsAndFiles/skill/src/viewControllers/BookForm.vc.d.ts +8 -0
  130. package/build/__tests__/testDirsAndFiles/skill/src/viewControllers/BookForm.vc.js +31 -0
  131. package/build/esm/__tests__/behavioral/CanUseStoresSetupInBeforeEach.test.d.ts +7 -0
  132. package/build/esm/__tests__/behavioral/CanUseStoresSetupInBeforeEach.test.js +53 -0
  133. package/build/esm/__tests__/behavioral/DatabaseFixture.test.d.ts +7 -0
  134. package/build/esm/__tests__/behavioral/DatabaseFixture.test.js +48 -0
  135. package/build/esm/__tests__/behavioral/DbResetsAsExpected.test.d.ts +5 -0
  136. package/build/esm/__tests__/behavioral/DbResetsAsExpected.test.js +28 -0
  137. package/build/esm/__tests__/behavioral/DecoratoringEmitToPassThroughProxy.test.d.ts +15 -0
  138. package/build/esm/__tests__/behavioral/DecoratoringEmitToPassThroughProxy.test.js +125 -0
  139. package/build/esm/__tests__/behavioral/DelaysConnectWhenOnlyUsingLoginDecorator.test.d.ts +4 -0
  140. package/build/esm/__tests__/behavioral/DelaysConnectWhenOnlyUsingLoginDecorator.test.js +40 -0
  141. package/build/esm/__tests__/behavioral/DisablingSchemaValidationOnTest.test.d.ts +5 -0
  142. package/build/esm/__tests__/behavioral/DisablingSchemaValidationOnTest.test.js +23 -0
  143. package/build/esm/__tests__/behavioral/DoesntResetAccountIfOnlySeedingLocally.test.d.ts +8 -0
  144. package/build/esm/__tests__/behavioral/DoesntResetAccountIfOnlySeedingLocally.test.js +76 -0
  145. package/build/esm/__tests__/behavioral/DummyStore.d.ts +55 -0
  146. package/build/esm/__tests__/behavioral/DummyStore.js +43 -0
  147. package/build/esm/__tests__/behavioral/FakingEventResponses.test.d.ts +12 -0
  148. package/build/esm/__tests__/behavioral/FakingEventResponses.test.js +147 -0
  149. package/build/esm/__tests__/behavioral/FixtureFactory.test.d.ts +7 -0
  150. package/build/esm/__tests__/behavioral/FixtureFactory.test.js +61 -0
  151. package/build/esm/__tests__/behavioral/LocationFixture.test.d.ts +15 -0
  152. package/build/esm/__tests__/behavioral/LocationFixture.test.js +153 -0
  153. package/build/esm/__tests__/behavioral/LoginDecoratorHandlingProxiesForMe.test.d.ts +12 -0
  154. package/build/esm/__tests__/behavioral/LoginDecoratorHandlingProxiesForMe.test.js +110 -0
  155. package/build/esm/__tests__/behavioral/MakingSureLocalEventsAreHandledLocally.test.d.ts +4 -0
  156. package/build/esm/__tests__/behavioral/MakingSureLocalEventsAreHandledLocally.test.js +38 -0
  157. package/build/esm/__tests__/behavioral/MercuryFixture.test.d.ts +19 -0
  158. package/build/esm/__tests__/behavioral/MercuryFixture.test.js +209 -0
  159. package/build/esm/__tests__/behavioral/OrganizationFixture.test.d.ts +31 -0
  160. package/build/esm/__tests__/behavioral/OrganizationFixture.test.js +387 -0
  161. package/build/esm/__tests__/behavioral/PatchingConsoleErrorToErrorStream.test.d.ts +4 -0
  162. package/build/esm/__tests__/behavioral/PatchingConsoleErrorToErrorStream.test.js +18 -0
  163. package/build/esm/__tests__/behavioral/PersonFixture.test.d.ts +22 -0
  164. package/build/esm/__tests__/behavioral/PersonFixture.test.js +231 -0
  165. package/build/esm/__tests__/behavioral/PhoneNumberIncrementor.test.d.ts +11 -0
  166. package/build/esm/__tests__/behavioral/PhoneNumberIncrementor.test.js +112 -0
  167. package/build/esm/__tests__/behavioral/ResettingAccountLocationsInBeforeAll.test.d.ts +8 -0
  168. package/build/esm/__tests__/behavioral/ResettingAccountLocationsInBeforeAll.test.js +80 -0
  169. package/build/esm/__tests__/behavioral/ResettingAccountOrgsInAfterAll.test.d.ts +5 -0
  170. package/build/esm/__tests__/behavioral/ResettingAccountOrgsInAfterAll.test.js +51 -0
  171. package/build/esm/__tests__/behavioral/ResettingAccountOrgsInBeforeAll.test.d.ts +7 -0
  172. package/build/esm/__tests__/behavioral/ResettingAccountOrgsInBeforeAll.test.js +59 -0
  173. package/build/esm/__tests__/behavioral/ResettingFixtureFieldsBeforeEach.test.d.ts +10 -0
  174. package/build/esm/__tests__/behavioral/ResettingFixtureFieldsBeforeEach.test.js +139 -0
  175. package/build/esm/__tests__/behavioral/ResettingLocalEventListeningBeforeSeeding.test.d.ts +7 -0
  176. package/build/esm/__tests__/behavioral/ResettingLocalEventListeningBeforeSeeding.test.js +57 -0
  177. package/build/esm/__tests__/behavioral/RetainsContractWhenLoggingInUsingDecotorator.test.d.ts +6 -0
  178. package/build/esm/__tests__/behavioral/RetainsContractWhenLoggingInUsingDecotorator.test.js +48 -0
  179. package/build/esm/__tests__/behavioral/RoleFixture.test.d.ts +15 -0
  180. package/build/esm/__tests__/behavioral/RoleFixture.test.js +143 -0
  181. package/build/esm/__tests__/behavioral/SeedingData.test.d.ts +24 -0
  182. package/build/esm/__tests__/behavioral/SeedingData.test.js +314 -0
  183. package/build/esm/__tests__/behavioral/SkillFixture.test.d.ts +13 -0
  184. package/build/esm/__tests__/behavioral/SkillFixture.test.js +139 -0
  185. package/build/esm/__tests__/behavioral/StoreFixture.test.d.ts +23 -0
  186. package/build/esm/__tests__/behavioral/StoreFixture.test.js +164 -0
  187. package/build/esm/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.d.ts +9 -0
  188. package/build/esm/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.js +87 -0
  189. package/build/esm/__tests__/behavioral/faking/FakeDecorator.test.d.ts +45 -0
  190. package/build/esm/__tests__/behavioral/faking/FakeDecorator.test.js +479 -0
  191. package/build/esm/__tests__/behavioral/faking/FakeDecoratorSetsPerson.test.d.ts +4 -0
  192. package/build/esm/__tests__/behavioral/faking/FakeDecoratorSetsPerson.test.js +28 -0
  193. package/build/esm/__tests__/behavioral/faking/FakeDecoratorWhoAmI.test.d.ts +4 -0
  194. package/build/esm/__tests__/behavioral/faking/FakeDecoratorWhoAmI.test.js +32 -0
  195. package/build/esm/__tests__/behavioral/faking/FakeThemeManager.test.d.ts +8 -0
  196. package/build/esm/__tests__/behavioral/faking/FakeThemeManager.test.js +82 -0
  197. package/build/esm/__tests__/behavioral/faking/FakingAddingPeopleToALocation.test.d.ts +8 -0
  198. package/build/esm/__tests__/behavioral/faking/FakingAddingPeopleToALocation.test.js +70 -0
  199. package/build/esm/__tests__/behavioral/faking/FakingAddingPeopleToAnOrg.test.d.ts +14 -0
  200. package/build/esm/__tests__/behavioral/faking/FakingAddingPeopleToAnOrg.test.js +165 -0
  201. package/build/esm/__tests__/behavioral/faking/FakingInBeforeEach.test.d.ts +6 -0
  202. package/build/esm/__tests__/behavioral/faking/FakingInBeforeEach.test.js +55 -0
  203. package/build/esm/__tests__/behavioral/faking/FakingRoleEvents.test.d.ts +19 -0
  204. package/build/esm/__tests__/behavioral/faking/FakingRoleEvents.test.js +175 -0
  205. package/build/esm/__tests__/behavioral/faking/FakingSkillEvents.test.d.ts +24 -0
  206. package/build/esm/__tests__/behavioral/faking/FakingSkillEvents.test.js +214 -0
  207. package/build/esm/__tests__/behavioral/faking/UpdatePerson.test.d.ts +4 -0
  208. package/build/esm/__tests__/behavioral/faking/UpdatePerson.test.js +38 -0
  209. package/build/esm/__tests__/behavioral/faking/UsingFakeDecorators.test.d.ts +35 -0
  210. package/build/esm/__tests__/behavioral/faking/UsingFakeDecorators.test.js +360 -0
  211. package/build/esm/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.d.ts +4 -0
  212. package/build/esm/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.js +31 -0
  213. package/build/esm/__tests__/behavioral/faking/WhoAmI.test.d.ts +19 -0
  214. package/build/esm/__tests__/behavioral/faking/WhoAmI.test.js +140 -0
  215. package/build/esm/__tests__/behavioral/maps/SpyingMapUtil.test.d.ts +10 -0
  216. package/build/esm/__tests__/behavioral/maps/SpyingMapUtil.test.js +94 -0
  217. package/build/esm/__tests__/behavioral/seeding/UsingDecorators.test.d.ts +37 -0
  218. package/build/esm/__tests__/behavioral/seeding/UsingDecorators.test.js +322 -0
  219. package/build/esm/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.d.ts +14 -0
  220. package/build/esm/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.js +134 -0
  221. package/build/esm/__tests__/behavioral/views/CheckingPermissions.test.d.ts +24 -0
  222. package/build/esm/__tests__/behavioral/views/CheckingPermissions.test.js +200 -0
  223. package/build/esm/__tests__/behavioral/views/FakingSkillViewControllers.test.d.ts +12 -0
  224. package/build/esm/__tests__/behavioral/views/FakingSkillViewControllers.test.js +69 -0
  225. package/build/esm/__tests__/behavioral/views/Routing.test.d.ts +31 -0
  226. package/build/esm/__tests__/behavioral/views/Routing.test.js +169 -0
  227. package/build/esm/__tests__/behavioral/views/TestingScope.test.d.ts +9 -0
  228. package/build/esm/__tests__/behavioral/views/TestingScope.test.js +84 -0
  229. package/build/esm/__tests__/behavioral/views/ViewFixture.test.d.ts +102 -0
  230. package/build/esm/__tests__/behavioral/views/ViewFixture.test.js +731 -0
  231. package/build/esm/__tests__/behavioral/views/WorkingWithTimezones.test.d.ts +11 -0
  232. package/build/esm/__tests__/behavioral/views/WorkingWithTimezones.test.js +63 -0
  233. package/build/esm/__tests__/support/AbstractFakeDecoratorTest.d.ts +5 -0
  234. package/build/esm/__tests__/support/AbstractFakeDecoratorTest.js +34 -0
  235. package/build/esm/__tests__/support/EventFaker.d.ts +5 -0
  236. package/build/esm/__tests__/support/EventFaker.js +45 -0
  237. package/build/esm/__tests__/support/FakeThemeManager.d.ts +8 -0
  238. package/build/esm/__tests__/support/FakeThemeManager.js +37 -0
  239. package/build/esm/__tests__/test.types.d.ts +2 -0
  240. package/build/esm/__tests__/test.types.js +1 -0
  241. package/build/esm/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.d.ts +51 -0
  242. package/build/esm/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.js +41 -0
  243. package/build/esm/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Book.svc.d.ts +5 -0
  244. package/build/esm/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Book.svc.js +8 -0
  245. package/build/esm/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.d.ts +7 -0
  246. package/build/esm/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.js +27 -0
  247. package/build/esm/__tests__/testDirsAndFiles/skill/build/viewControllers/BookForm.vc.d.ts +8 -0
  248. package/build/esm/__tests__/testDirsAndFiles/skill/build/viewControllers/BookForm.vc.js +25 -0
  249. package/build/esm/__tests__/testDirsAndFiles/skill/src/skillViewControllers/Book.svc.d.ts +5 -0
  250. package/build/esm/__tests__/testDirsAndFiles/skill/src/skillViewControllers/Book.svc.js +8 -0
  251. package/build/esm/__tests__/testDirsAndFiles/skill/src/viewControllers/BookForm.vc.d.ts +8 -0
  252. package/build/esm/__tests__/testDirsAndFiles/skill/src/viewControllers/BookForm.vc.js +25 -0
  253. package/build/esm/index.d.ts +1 -0
  254. package/build/esm/index.js +1 -0
  255. package/build/esm/tests/decorators/fake.js +7 -1
  256. package/build/esm/tests/fixtures/ViewFixture.d.ts +1 -0
  257. package/build/esm/tests/fixtures/ViewFixture.js +4 -1
  258. package/build/esm/tests/routers/TestRouter.d.ts +3 -0
  259. package/build/esm/tests/routers/TestRouter.js +6 -0
  260. package/build/esm/utilities/vcDisk.utility.js +1 -0
  261. package/build/index.d.ts +1 -0
  262. package/build/index.js +3 -1
  263. package/build/tests/decorators/fake.js +7 -1
  264. package/build/tests/fixtures/ViewFixture.d.ts +1 -0
  265. package/build/tests/fixtures/ViewFixture.js +4 -1
  266. package/build/tests/routers/TestRouter.d.ts +3 -0
  267. package/build/tests/routers/TestRouter.js +6 -0
  268. package/build/utilities/vcDisk.utility.js +1 -0
  269. package/package.json +11 -11
@@ -0,0 +1,266 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
13
+ const mercury_client_1 = require("@sprucelabs/mercury-client");
14
+ const test_1 = require("@sprucelabs/test");
15
+ const __1 = require("../../..");
16
+ const AbstractSpruceFixtureTest_1 = __importDefault(require("../../../tests/AbstractSpruceFixtureTest"));
17
+ const constants_1 = require("../../../tests/constants");
18
+ const login_1 = __importDefault(require("../../../tests/decorators/login"));
19
+ const seed_1 = __importDefault(require("../../../tests/decorators/seed"));
20
+ // eslint-disable-next-line spruce/prohibit-import-from-build-folder
21
+ const Good_store_1 = __importDefault(require("../../testDirsAndFiles/one-good-store-skill/build/stores/Good.store"));
22
+ const DummyStore_1 = require("../DummyStore");
23
+ let UsingDecoratorsTest = class UsingDecoratorsTest extends AbstractSpruceFixtureTest_1.default {
24
+ static async beforeEach() {
25
+ test_1.assert.isTrue(mercury_client_1.MercuryClientFactory.isInTestMode());
26
+ this.goodStore = await this.Fixture('store').Store('good');
27
+ await this.assertCountGoods(5);
28
+ await super.beforeEach();
29
+ const auth = heartwood_view_controllers_1.AuthenticatorImpl.getInstance();
30
+ test_1.assert.isTruthy(auth.getSessionToken());
31
+ const client = login_1.default.getClient();
32
+ const person = login_1.default.getPerson();
33
+ //@ts-ignore
34
+ test_1.assert.isEqualDeep(person, client.auth.person);
35
+ test_1.assert.isTruthy(client);
36
+ test_1.assert.isTrue(client.isConnected());
37
+ test_1.assert.isTrue(client.getIsTestClient());
38
+ this.lastClient = client;
39
+ //@ts-ignore
40
+ test_1.assert.isEqualDeep(auth.getPerson(), client.auth.person);
41
+ //@ts-ignore
42
+ test_1.assert.isEqualDeep(auth.getSessionToken(), client.auth.token);
43
+ this.goodStore = await this.Fixture('store').Store('good');
44
+ await this.assertCountGoods(5);
45
+ }
46
+ static async afterAll() {
47
+ await super.afterAll();
48
+ const client = __1.MercuryFixture.getDefaultClient();
49
+ test_1.assert.isFalsy(client);
50
+ test_1.assert.isFalse(this.lastClient.isConnected());
51
+ }
52
+ static async loginSetsDefaultClient() {
53
+ const client = __1.MercuryFixture.getDefaultClient();
54
+ test_1.assert.isTruthy(client);
55
+ test_1.assert.isTrue(client.isConnected());
56
+ }
57
+ static async retainsClientBetweenTests() {
58
+ const client = __1.MercuryFixture.getDefaultClient();
59
+ test_1.assert.isTruthy(client);
60
+ test_1.assert.isEqual(this.lastClient, client);
61
+ test_1.assert.isTrue(client.isConnected());
62
+ }
63
+ static async canSeedThreeOrgs() {
64
+ await this.assertCountOrgs(3);
65
+ }
66
+ static async canSeedFiveOrgs() {
67
+ await this.assertCountOrgs(5);
68
+ }
69
+ static async canSeedTwoLocations() {
70
+ await this.assertCountLocations(3);
71
+ }
72
+ static async seededLocationsArePublic() {
73
+ const locations = await this.locations.listLocations();
74
+ for (const location of locations) {
75
+ test_1.assert.isTrue(location.isPublic);
76
+ }
77
+ }
78
+ static async canSeedTenLocations() {
79
+ await this.assertCountLocations(10);
80
+ }
81
+ static async locationUsesLatestOrg() {
82
+ await this.assertCountLocations(10);
83
+ await this.assertCountOrgs(10);
84
+ }
85
+ static async canSeedStores() {
86
+ test_1.assert.isTrue(DummyStore_1.DummyStore.wasSeedInvoked);
87
+ test_1.assert.isEqualDeep(DummyStore_1.DummyStore.seedOptions, {
88
+ totalToSeed: 10,
89
+ TestClass: this,
90
+ });
91
+ }
92
+ static logsInViewAuthenticator() {
93
+ test_1.assert.isTruthy(heartwood_view_controllers_1.AuthenticatorImpl.getInstance().getSessionToken());
94
+ }
95
+ static passesThroughArgs(one, two, three) {
96
+ test_1.assert.isEqual(one, 1);
97
+ test_1.assert.isEqual(two, 1);
98
+ test_1.assert.isEqual(three, 1);
99
+ }
100
+ static passesThroughArgs2(one) {
101
+ test_1.assert.isEqualDeep(one, { hello: 'world' });
102
+ }
103
+ static async seedsAddToBeforeEach() {
104
+ await this.assertCountGoods(10);
105
+ }
106
+ static async seedsAddToBeforeEachButNotLastRun() {
107
+ await this.assertCountGoods(6);
108
+ }
109
+ static async canGetClientOffLogin() {
110
+ test_1.assert.isFunction(login_1.default.getClient);
111
+ test_1.assert.isEqual(login_1.default.getClient(), __1.MercuryFixture.getDefaultClient());
112
+ }
113
+ static async storeGetsVariablesPassed() {
114
+ test_1.assert.isEqualDeep(Good_store_1.default.seedParams, ['hello', 'world']);
115
+ }
116
+ static async storeGetsVariablesPassed2() {
117
+ test_1.assert.isEqualDeep(Good_store_1.default.seedParams, ['goodbye', 'people']);
118
+ }
119
+ static async canSeedPeople(baseCounts) {
120
+ await this.assertExpectedSeededPeople(baseCounts);
121
+ }
122
+ static async assertExpectedSeededPeople(baseCounts) {
123
+ const bases = Object.keys(baseCounts);
124
+ for (const base of bases) {
125
+ const count = baseCounts[base];
126
+ await this.assertTotalPeopleByRole(base, count);
127
+ }
128
+ }
129
+ static async canSeedMorePeople(baseCounts) {
130
+ await this.assertExpectedSeededPeople(baseCounts);
131
+ }
132
+ static async assertCountOrgs(expected) {
133
+ const organizations = await this.organizations.listOrganizations();
134
+ test_1.assert.isLength(organizations, expected);
135
+ }
136
+ static async assertCountLocations(expected) {
137
+ const org = await this.views.getScope().getCurrentOrganization();
138
+ test_1.assert.isTruthy(org);
139
+ const organizationId = org.id;
140
+ const locations = await this.locations.listLocations(organizationId);
141
+ test_1.assert.isLength(locations, expected);
142
+ }
143
+ static async assertCountGoods(expected) {
144
+ const goodStore = await this.stores.Store('good');
145
+ const count = await goodStore.count({});
146
+ test_1.assert.isEqual(count, expected);
147
+ const localCount = await this.goodStore.count({});
148
+ test_1.assert.isEqual(localCount, expected, 'The store built in beforeEach is pointing at stale database.');
149
+ }
150
+ static async assertTotalPeopleByRole(roleBase, total) {
151
+ const org = await this.organizations.getNewestOrganization();
152
+ test_1.assert.isTruthy(org);
153
+ const teammates = await this.people.listPeople({
154
+ organizationId: org.id,
155
+ roleBases: [roleBase],
156
+ });
157
+ test_1.assert.isLength(teammates, total);
158
+ }
159
+ };
160
+ __decorate([
161
+ (0, seed_1.default)('good', 5),
162
+ (0, seed_1.default)('dummies', 10)
163
+ ], UsingDecoratorsTest, "beforeEach", null);
164
+ __decorate([
165
+ (0, test_1.test)()
166
+ ], UsingDecoratorsTest, "loginSetsDefaultClient", null);
167
+ __decorate([
168
+ (0, test_1.test)()
169
+ ], UsingDecoratorsTest, "retainsClientBetweenTests", null);
170
+ __decorate([
171
+ (0, test_1.test)(),
172
+ (0, seed_1.default)('organizations', 3)
173
+ ], UsingDecoratorsTest, "canSeedThreeOrgs", null);
174
+ __decorate([
175
+ (0, test_1.test)(),
176
+ (0, seed_1.default)('organizations', 5)
177
+ ], UsingDecoratorsTest, "canSeedFiveOrgs", null);
178
+ __decorate([
179
+ (0, test_1.test)(),
180
+ (0, seed_1.default)('locations', 3)
181
+ ], UsingDecoratorsTest, "canSeedTwoLocations", null);
182
+ __decorate([
183
+ (0, test_1.test)(),
184
+ (0, seed_1.default)('locations', 3)
185
+ ], UsingDecoratorsTest, "seededLocationsArePublic", null);
186
+ __decorate([
187
+ (0, test_1.test)(),
188
+ (0, seed_1.default)('locations', 10)
189
+ ], UsingDecoratorsTest, "canSeedTenLocations", null);
190
+ __decorate([
191
+ (0, test_1.test)(),
192
+ (0, seed_1.default)('organizations', 10),
193
+ (0, seed_1.default)('locations', 10)
194
+ ], UsingDecoratorsTest, "locationUsesLatestOrg", null);
195
+ __decorate([
196
+ (0, test_1.test)(),
197
+ (0, seed_1.default)('dummies', 10)
198
+ ], UsingDecoratorsTest, "canSeedStores", null);
199
+ __decorate([
200
+ (0, test_1.test)()
201
+ ], UsingDecoratorsTest, "logsInViewAuthenticator", null);
202
+ __decorate([
203
+ (0, test_1.test)('passes through args 1', 1, 1, 1),
204
+ (0, seed_1.default)('dummies', 3)
205
+ ], UsingDecoratorsTest, "passesThroughArgs", null);
206
+ __decorate([
207
+ (0, test_1.test)('passes through args 2', { hello: 'world' }),
208
+ (0, seed_1.default)('dummies', 3)
209
+ ], UsingDecoratorsTest, "passesThroughArgs2", null);
210
+ __decorate([
211
+ (0, test_1.test)(),
212
+ (0, seed_1.default)('good', 5)
213
+ ], UsingDecoratorsTest, "seedsAddToBeforeEach", null);
214
+ __decorate([
215
+ (0, test_1.test)(),
216
+ (0, seed_1.default)('good', 1)
217
+ ], UsingDecoratorsTest, "seedsAddToBeforeEachButNotLastRun", null);
218
+ __decorate([
219
+ (0, test_1.test)()
220
+ ], UsingDecoratorsTest, "canGetClientOffLogin", null);
221
+ __decorate([
222
+ (0, test_1.test)(),
223
+ (0, seed_1.default)('good', 1, 'hello', 'world')
224
+ ], UsingDecoratorsTest, "storeGetsVariablesPassed", null);
225
+ __decorate([
226
+ (0, test_1.test)(),
227
+ (0, seed_1.default)('good', 1, 'goodbye', 'people')
228
+ ], UsingDecoratorsTest, "storeGetsVariablesPassed2", null);
229
+ __decorate([
230
+ (0, test_1.test)('can seed people', {
231
+ guest: 2,
232
+ teammate: 2,
233
+ groupManager: 2,
234
+ manager: 2,
235
+ owner: 3,
236
+ }),
237
+ (0, seed_1.default)('organizations', 1),
238
+ (0, seed_1.default)('locations', 1),
239
+ (0, seed_1.default)('teammates', 2),
240
+ (0, seed_1.default)('guests', 2),
241
+ (0, seed_1.default)('groupManagers', 2),
242
+ (0, seed_1.default)('managers', 2),
243
+ (0, seed_1.default)('owners', 2)
244
+ ], UsingDecoratorsTest, "canSeedPeople", null);
245
+ __decorate([
246
+ (0, test_1.test)('can seed more people', {
247
+ guest: 5,
248
+ teammate: 5,
249
+ groupManager: 3,
250
+ manager: 4,
251
+ owner: 6,
252
+ }),
253
+ (0, seed_1.default)('organizations', 1),
254
+ (0, seed_1.default)('locations', 1),
255
+ (0, seed_1.default)('teammates', 5),
256
+ (0, seed_1.default)('guests', 5),
257
+ (0, seed_1.default)('groupManagers', 3),
258
+ (0, seed_1.default)('managers', 4),
259
+ (0, seed_1.default)('owners', 5)
260
+ ], UsingDecoratorsTest, "canSeedMorePeople", null);
261
+ UsingDecoratorsTest = __decorate([
262
+ (0, login_1.default)(constants_1.DEMO_NUMBER_DECORATORS)
263
+ ], UsingDecoratorsTest);
264
+ exports.default = UsingDecoratorsTest;
265
+ __1.StoreFixture.setStore('dummies', DummyStore_1.DummyStore);
266
+ __1.StoreFixture.setStore('good', Good_store_1.default);
@@ -0,0 +1,14 @@
1
+ import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
2
+ export default class UsingDecoratorsToInstallSkills extends AbstractSpruceFixtureTest {
3
+ private static skill;
4
+ protected static beforeEach(): Promise<void>;
5
+ protected static throwsWhenMissingNamespaces(): void;
6
+ protected static returnsDecorator(): void;
7
+ protected static callsOriginalTestMethod(): Promise<void>;
8
+ protected static passesThroughOriginalArgs(args: any): Promise<void>;
9
+ protected static throwsWithoutSeedingOrg(): Promise<void>;
10
+ protected static throwsWhenInstallingBadSkill(): Promise<void>;
11
+ protected static doesNotEmitDidInstall(): Promise<void>;
12
+ private static executeDecorator;
13
+ private static getDecorator;
14
+ }
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const test_1 = require("@sprucelabs/test");
13
+ const AbstractSpruceFixtureTest_1 = __importDefault(require("../../../tests/AbstractSpruceFixtureTest"));
14
+ const constants_1 = require("../../../tests/constants");
15
+ const install_1 = __importDefault(require("../../../tests/decorators/install"));
16
+ const login_1 = __importDefault(require("../../../tests/decorators/login"));
17
+ const seed_1 = __importDefault(require("../../../tests/decorators/seed"));
18
+ let UsingDecoratorsToInstallSkills = class UsingDecoratorsToInstallSkills extends AbstractSpruceFixtureTest_1.default {
19
+ static async beforeEach() {
20
+ await super.beforeEach();
21
+ this.skill = await this.skills.seedDemoSkill();
22
+ }
23
+ static throwsWhenMissingNamespaces() {
24
+ test_1.assert.doesThrow(() => install_1.default.skills());
25
+ }
26
+ static returnsDecorator() {
27
+ const decorator = this.getDecorator();
28
+ test_1.assert.isFunction(decorator);
29
+ }
30
+ static async callsOriginalTestMethod() {
31
+ let wasHit = false;
32
+ await this.executeDecorator({
33
+ testFunction: async () => {
34
+ wasHit = true;
35
+ },
36
+ });
37
+ test_1.assert.isTrue(wasHit);
38
+ }
39
+ static async passesThroughOriginalArgs(args) {
40
+ let passedArgs;
41
+ await this.executeDecorator({
42
+ testFunction: async (...args) => {
43
+ passedArgs = args;
44
+ },
45
+ args,
46
+ });
47
+ test_1.assert.isEqualDeep(passedArgs, args);
48
+ }
49
+ static async throwsWithoutSeedingOrg() {
50
+ await test_1.assert.doesThrowAsync(() => this.executeDecorator({ testFunction: async () => { } }));
51
+ }
52
+ static async throwsWhenInstallingBadSkill() {
53
+ await test_1.assert.doesThrowAsync(() => this.executeDecorator({
54
+ testFunction: async () => { },
55
+ namespaces: ['not-found'],
56
+ }));
57
+ }
58
+ static async doesNotEmitDidInstall() {
59
+ let passedPayload;
60
+ await login_1.default.getClient().on('install-skill::v2020_12_25', ({ payload }) => {
61
+ passedPayload = payload;
62
+ return {};
63
+ });
64
+ await this.executeDecorator({
65
+ testFunction: async () => { },
66
+ });
67
+ test_1.assert.isFalse(passedPayload.shouldNotifySkillOfInstall);
68
+ }
69
+ static async executeDecorator(options) {
70
+ const { testFunction, args, namespaces } = options;
71
+ const mockDescriptor = {
72
+ value: testFunction,
73
+ };
74
+ const decorator = this.getDecorator(namespaces);
75
+ decorator(this, 'myTest', mockDescriptor);
76
+ //@ts-ignore
77
+ await mockDescriptor.value(...(args ? args : []));
78
+ }
79
+ static getDecorator(namespaces) {
80
+ const slugs = namespaces !== null && namespaces !== void 0 ? namespaces : [this.skill.slug];
81
+ return install_1.default.skills(...slugs);
82
+ }
83
+ };
84
+ __decorate([
85
+ (0, test_1.test)()
86
+ ], UsingDecoratorsToInstallSkills, "throwsWhenMissingNamespaces", null);
87
+ __decorate([
88
+ (0, test_1.test)()
89
+ ], UsingDecoratorsToInstallSkills, "returnsDecorator", null);
90
+ __decorate([
91
+ (0, test_1.test)(),
92
+ (0, seed_1.default)('organizations', 1)
93
+ ], UsingDecoratorsToInstallSkills, "callsOriginalTestMethod", null);
94
+ __decorate([
95
+ (0, test_1.test)('passes args 1', [1]),
96
+ (0, test_1.test)('passes args 1', ['hello', 'world']),
97
+ (0, seed_1.default)('organizations', 1)
98
+ ], UsingDecoratorsToInstallSkills, "passesThroughOriginalArgs", null);
99
+ __decorate([
100
+ (0, test_1.test)()
101
+ ], UsingDecoratorsToInstallSkills, "throwsWithoutSeedingOrg", null);
102
+ __decorate([
103
+ (0, test_1.test)(),
104
+ (0, seed_1.default)('organizations', 1)
105
+ ], UsingDecoratorsToInstallSkills, "throwsWhenInstallingBadSkill", null);
106
+ __decorate([
107
+ (0, test_1.test)(),
108
+ (0, seed_1.default)('organizations', 1)
109
+ ], UsingDecoratorsToInstallSkills, "doesNotEmitDidInstall", null);
110
+ UsingDecoratorsToInstallSkills = __decorate([
111
+ (0, login_1.default)(constants_1.DEMO_NUMBER_SKILL_DECORATORS)
112
+ ], UsingDecoratorsToInstallSkills);
113
+ exports.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,162 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const test_1 = require("@sprucelabs/test");
13
+ const test_utils_1 = require("@sprucelabs/test-utils");
14
+ const AbstractSpruceFixtureTest_1 = __importDefault(require("../../../tests/AbstractSpruceFixtureTest"));
15
+ const ViewFixture_1 = __importDefault(require("../../../tests/fixtures/ViewFixture"));
16
+ const SpyAuthorizer_1 = __importDefault(require("../../../tests/SpyAuthorizer"));
17
+ class CheckingPermissionsTest extends AbstractSpruceFixtureTest_1.default {
18
+ static async beforeEach() {
19
+ await super.beforeEach();
20
+ this.contractId = (0, test_utils_1.generateId)();
21
+ }
22
+ static async canCreateCheckingPermissions() {
23
+ const instance = CheckingPermissionsTest.getInstance();
24
+ test_1.assert.isTrue(instance instanceof SpyAuthorizer_1.default);
25
+ }
26
+ static async sharesInstances() {
27
+ test_1.assert.isEqual(this.getInstance(), this.getInstance());
28
+ }
29
+ static async viewsFixtureResetsInstance() {
30
+ const instance = this.getInstance();
31
+ await ViewFixture_1.default.beforeEach();
32
+ test_1.assert.isNotEqual(this.getInstance(), instance);
33
+ }
34
+ static async throwsWhenMissingOnCan() {
35
+ const err = await test_1.assert.doesThrowAsync(() =>
36
+ //@ts-ignore
37
+ this.getInstance().can());
38
+ test_utils_1.errorAssert.assertError(err, 'MISSING_PARAMETERS', {
39
+ parameters: ['contractId', 'permissionIds'],
40
+ });
41
+ }
42
+ static async throwsWhenNotSettingResponse() {
43
+ await this.assertThrowsFakeError();
44
+ }
45
+ static async throwsWhenContractIdNotFaked() {
46
+ this.fakePermissions([{ id: 'test', can: true }]);
47
+ this.changeContractId();
48
+ await this.assertThrowsFakeError();
49
+ }
50
+ static async doesNotThrowWhenMatchingSecondContractId() {
51
+ this.fakePermissions([{ id: 'test', can: true }]);
52
+ this.changeContractId();
53
+ this.fakePermissions([{ id: 'test2', can: true }]);
54
+ await this.can(['test2']);
55
+ }
56
+ static async throwsWhenNotFindingPermissionId() {
57
+ this.fakePermissions([{ id: 'test', can: true }]);
58
+ await this.assertPermNotFound(['test2'], 'test2');
59
+ }
60
+ static async throwsWhenFindingLaterMissingPermId() {
61
+ this.fakePermissions([{ id: 'test', can: true }]);
62
+ await this.assertPermNotFound(['test', 'test2'], 'test2');
63
+ }
64
+ static async returnsFakedResponses(permissionIds, can) {
65
+ const faked = [];
66
+ const expected = {};
67
+ permissionIds.forEach((id) => ((expected[id] = can), faked.push({ id, can })));
68
+ this.fakePermissions(faked);
69
+ const results = await this.can(permissionIds);
70
+ test_1.assert.isEqualDeep(results, expected);
71
+ }
72
+ static async fixtureAndLoadOptionsShareAuthorizer() {
73
+ this.views = this.Fixture('view', {
74
+ controllerMap: {},
75
+ });
76
+ const auth = this.views.getAuthorizer();
77
+ const router = this.views.getRouter();
78
+ test_1.assert.isEqual(auth, router.buildLoadOptions().authorizer);
79
+ }
80
+ static async authorizerClobbersMatchingContracts() {
81
+ this.fakePermissions([{ id: 'test', can: true }]);
82
+ this.fakePermissions([{ id: 'test', can: false }]);
83
+ const perms = await this.can(['test']);
84
+ test_1.assert.isFalse(perms['test']);
85
+ }
86
+ static async canHandleMulplePermissionsWithDifferentContracts() {
87
+ const firstId = this.contractId;
88
+ this.fakePermissions([{ id: 'test', can: true }]);
89
+ this.changeContractId();
90
+ this.fakePermissions([{ id: 'test', can: false }]);
91
+ this.contractId = firstId;
92
+ const perms = await this.can(['test']);
93
+ test_1.assert.isTrue(perms['test']);
94
+ }
95
+ static async assertPermNotFound(checkIds, id) {
96
+ await test_1.assert.doesThrowAsync(() => this.can(checkIds), id);
97
+ }
98
+ static changeContractId() {
99
+ this.contractId = (0, test_utils_1.generateId)();
100
+ }
101
+ static async assertThrowsFakeError() {
102
+ await test_1.assert.doesThrowAsync(() => this.can(['test']), `Contract by the id '${this.contractId}'`);
103
+ }
104
+ static fakePermissions(faked) {
105
+ this.getInstance().fakePermissions({
106
+ contractId: this.contractId,
107
+ permissions: faked,
108
+ });
109
+ }
110
+ static can(permissionIds) {
111
+ return this.getInstance().can({
112
+ contractId: this.contractId,
113
+ permissionIds,
114
+ });
115
+ }
116
+ static getInstance() {
117
+ return SpyAuthorizer_1.default.getInstance();
118
+ }
119
+ }
120
+ __decorate([
121
+ (0, test_1.test)()
122
+ ], CheckingPermissionsTest, "canCreateCheckingPermissions", null);
123
+ __decorate([
124
+ (0, test_1.test)()
125
+ ], CheckingPermissionsTest, "sharesInstances", null);
126
+ __decorate([
127
+ (0, test_1.test)()
128
+ ], CheckingPermissionsTest, "viewsFixtureResetsInstance", null);
129
+ __decorate([
130
+ (0, test_1.test)()
131
+ ], CheckingPermissionsTest, "throwsWhenMissingOnCan", null);
132
+ __decorate([
133
+ (0, test_1.test)()
134
+ ], CheckingPermissionsTest, "throwsWhenNotSettingResponse", null);
135
+ __decorate([
136
+ (0, test_1.test)()
137
+ ], CheckingPermissionsTest, "throwsWhenContractIdNotFaked", null);
138
+ __decorate([
139
+ (0, test_1.test)()
140
+ ], CheckingPermissionsTest, "doesNotThrowWhenMatchingSecondContractId", null);
141
+ __decorate([
142
+ (0, test_1.test)()
143
+ ], CheckingPermissionsTest, "throwsWhenNotFindingPermissionId", null);
144
+ __decorate([
145
+ (0, test_1.test)()
146
+ ], CheckingPermissionsTest, "throwsWhenFindingLaterMissingPermId", null);
147
+ __decorate([
148
+ (0, test_1.test)('returns false on can 1', ['first', 'second', 'third'], false),
149
+ (0, test_1.test)('returns false on can 2', ['third', 'fourth'], false),
150
+ (0, test_1.test)('returns false on can 3', ['first', 'second', 'third'], true),
151
+ (0, test_1.test)('returns false on can 4', ['third', 'fourth'], true)
152
+ ], CheckingPermissionsTest, "returnsFakedResponses", null);
153
+ __decorate([
154
+ (0, test_1.test)()
155
+ ], CheckingPermissionsTest, "fixtureAndLoadOptionsShareAuthorizer", null);
156
+ __decorate([
157
+ (0, test_1.test)()
158
+ ], CheckingPermissionsTest, "authorizerClobbersMatchingContracts", null);
159
+ __decorate([
160
+ (0, test_1.test)()
161
+ ], CheckingPermissionsTest, "canHandleMulplePermissionsWithDifferentContracts", null);
162
+ exports.default = CheckingPermissionsTest;
@@ -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,55 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
13
+ const schema_1 = require("@sprucelabs/schema");
14
+ const test_1 = require("@sprucelabs/test");
15
+ const AbstractSpruceFixtureTest_1 = __importDefault(require("../../../tests/AbstractSpruceFixtureTest"));
16
+ const Fake_svc_1 = __importDefault(require("../../../tests/Fake.svc"));
17
+ class FakingSkillViewControllersTest extends AbstractSpruceFixtureTest_1.default {
18
+ static async beforeEach() {
19
+ await super.beforeEach();
20
+ this.viewFixture = this.Fixture('view', {
21
+ controllerMap: {
22
+ fake: Fake_svc_1.default,
23
+ },
24
+ });
25
+ }
26
+ static async canRenderkFakeSkillViewController() {
27
+ const vc = this.viewFixture.Controller('fake', {});
28
+ const model = this.viewFixture.render(vc);
29
+ (0, schema_1.validateSchemaValues)(heartwood_view_controllers_1.skillViewSchema, model);
30
+ }
31
+ static async passesThroughConstructorAptions(options) {
32
+ const vc = this.viewFixture.Controller('fake', options);
33
+ test_1.assert.doesInclude(vc.constructorOptions, options);
34
+ }
35
+ static async passesThroughLoadArgs(args) {
36
+ const vc = this.viewFixture.Controller('fake', {});
37
+ await this.viewFixture.load(vc, args);
38
+ test_1.assert.isEqualDeep(vc.args, args);
39
+ }
40
+ }
41
+ FakingSkillViewControllersTest.controllerMap = {
42
+ fake: Fake_svc_1.default,
43
+ };
44
+ __decorate([
45
+ (0, test_1.test)()
46
+ ], FakingSkillViewControllersTest, "canRenderkFakeSkillViewController", null);
47
+ __decorate([
48
+ (0, test_1.test)('passed constructor options 1', { hello: 'world' }),
49
+ (0, test_1.test)('passed constructor options 2', { taco: 'bell' })
50
+ ], FakingSkillViewControllersTest, "passesThroughConstructorAptions", null);
51
+ __decorate([
52
+ (0, test_1.test)('passes args 1', { hello: 'world' }),
53
+ (0, test_1.test)('passes args 2', { cheesey: 'burrito' })
54
+ ], FakingSkillViewControllersTest, "passesThroughLoadArgs", null);
55
+ exports.default = FakingSkillViewControllersTest;