@prosopo/procaptcha 0.1.2 → 0.1.3

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 (42) hide show
  1. package/README.md +13 -0
  2. package/dist/api/ProsopoContract.d.ts +2 -1
  3. package/dist/api/ProsopoContract.d.ts.map +1 -1
  4. package/dist/api/ProsopoContract.js +4 -0
  5. package/dist/api/ProsopoContract.js.map +1 -1
  6. package/dist/modules/ProsopoCaptchaClient.d.ts +1 -0
  7. package/dist/modules/ProsopoCaptchaClient.d.ts.map +1 -1
  8. package/dist/modules/ProsopoCaptchaClient.js +2 -0
  9. package/dist/modules/ProsopoCaptchaClient.js.map +1 -1
  10. package/dist/modules/ProsopoCaptchaStateClient.d.ts.map +1 -1
  11. package/dist/modules/ProsopoCaptchaStateClient.js +9 -2
  12. package/dist/modules/ProsopoCaptchaStateClient.js.map +1 -1
  13. package/dist/types/api.d.ts +4 -0
  14. package/dist/types/api.d.ts.map +1 -1
  15. package/dist/types/client.d.ts +1 -1
  16. package/dist/types/client.d.ts.map +1 -1
  17. package/img/contracts-page.png +0 -0
  18. package/package.json +2 -2
  19. package/tsconfig.tsbuildinfo +1 -0
  20. package/src/api/AsyncFactory.ts +0 -30
  21. package/src/api/Extension.ts +0 -120
  22. package/src/api/HttpClientBase.ts +0 -37
  23. package/src/api/ProsopoContract.ts +0 -42
  24. package/src/api/ProsopoContractBase.ts +0 -169
  25. package/src/api/ProviderApi.ts +0 -59
  26. package/src/api/handlers.ts +0 -29
  27. package/src/api/index.ts +0 -21
  28. package/src/index.ts +0 -18
  29. package/src/modules/ProsopoCaptchaApi.ts +0 -105
  30. package/src/modules/ProsopoCaptchaClient.ts +0 -132
  31. package/src/modules/ProsopoCaptchaStateClient.ts +0 -146
  32. package/src/modules/client.ts +0 -39
  33. package/src/modules/contract.ts +0 -27
  34. package/src/modules/extension.ts +0 -20
  35. package/src/modules/index.ts +0 -22
  36. package/src/modules/storage.ts +0 -35
  37. package/src/types/api.ts +0 -80
  38. package/src/types/client.ts +0 -88
  39. package/src/types/contract.ts +0 -21
  40. package/src/types/index.ts +0 -18
  41. package/tests/mocks/browser.ts +0 -25
  42. package/tests/modules/client.test.ts +0 -56
@@ -1,56 +0,0 @@
1
- // import { LocalStorageMock } from "../mocks/browser";
2
- import { ProsopoCaptchaConfig } from "../../src/types/api";
3
-
4
- import { captchaContextReducer, captchaStateReducer, captchaStatusReducer } from "../../src/modules/client";
5
- import { ICaptchaContextState, ICaptchaState } from "../../src/types/client";
6
-
7
- import chai from "chai";
8
-
9
- const expect = chai.expect;
10
-
11
- describe("CLIENT UNIT TESTS", () => {
12
-
13
- // var localStorage: LocalStorageMock;
14
-
15
- const testConfig: ProsopoCaptchaConfig = {
16
- "providerApi.baseURL": "http://localhost:3000",
17
- "providerApi.prefix": "/v1/prosopo",
18
- "dappAccount": "",
19
- }
20
-
21
- before(async () => {
22
- // localStorage = new LocalStorageMock();
23
- });
24
-
25
- it("client context reducer", async () => {
26
-
27
- const testState: ICaptchaContextState = {
28
- config: testConfig,
29
- contractAddress: "test",
30
- }
31
-
32
- testConfig.dappAccount = "dapp";
33
- const contextReducer = captchaContextReducer(testState, { config: testConfig });
34
-
35
- expect(contextReducer.config.dappAccount).to.equal(testConfig.dappAccount);
36
-
37
- });
38
-
39
- it("client state reducer", async () => {
40
-
41
- const testState: ICaptchaState = {
42
- captchaIndex: 0,
43
- captchaSolution: [[0, 1, 2, 3]],
44
- }
45
-
46
- const captchaSolution = testState.captchaSolution;
47
- captchaSolution.push([4, 5]);
48
-
49
- const stateReducer = captchaStateReducer(testState, { captchaSolution });
50
-
51
- expect(stateReducer.captchaSolution.length).to.equal(2);
52
- expect(stateReducer.captchaSolution[1]).to.include.members([4, 5]);
53
-
54
- });
55
-
56
- });