@prosopo/procaptcha 0.1.2 → 0.1.5

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 (45) hide show
  1. package/LICENSE +201 -674
  2. package/README.md +13 -0
  3. package/dist/api/ProsopoContract.d.ts +2 -1
  4. package/dist/api/ProsopoContract.d.ts.map +1 -1
  5. package/dist/api/ProsopoContract.js +4 -0
  6. package/dist/api/ProsopoContract.js.map +1 -1
  7. package/dist/modules/ProsopoCaptchaClient.d.ts +1 -0
  8. package/dist/modules/ProsopoCaptchaClient.d.ts.map +1 -1
  9. package/dist/modules/ProsopoCaptchaClient.js +3 -1
  10. package/dist/modules/ProsopoCaptchaClient.js.map +1 -1
  11. package/dist/modules/ProsopoCaptchaStateClient.d.ts.map +1 -1
  12. package/dist/modules/ProsopoCaptchaStateClient.js +9 -2
  13. package/dist/modules/ProsopoCaptchaStateClient.js.map +1 -1
  14. package/dist/modules/contract.js +12 -0
  15. package/dist/modules/contract.js.map +1 -1
  16. package/dist/types/api.d.ts +4 -0
  17. package/dist/types/api.d.ts.map +1 -1
  18. package/dist/types/client.d.ts +1 -1
  19. package/dist/types/client.d.ts.map +1 -1
  20. package/img/contracts-page.png +0 -0
  21. package/package.json +11 -11
  22. package/tsconfig.tsbuildinfo +1 -0
  23. package/src/api/AsyncFactory.ts +0 -30
  24. package/src/api/Extension.ts +0 -120
  25. package/src/api/HttpClientBase.ts +0 -37
  26. package/src/api/ProsopoContract.ts +0 -42
  27. package/src/api/ProsopoContractBase.ts +0 -169
  28. package/src/api/ProviderApi.ts +0 -59
  29. package/src/api/handlers.ts +0 -29
  30. package/src/api/index.ts +0 -21
  31. package/src/index.ts +0 -18
  32. package/src/modules/ProsopoCaptchaApi.ts +0 -105
  33. package/src/modules/ProsopoCaptchaClient.ts +0 -132
  34. package/src/modules/ProsopoCaptchaStateClient.ts +0 -146
  35. package/src/modules/client.ts +0 -39
  36. package/src/modules/contract.ts +0 -27
  37. package/src/modules/extension.ts +0 -20
  38. package/src/modules/index.ts +0 -22
  39. package/src/modules/storage.ts +0 -35
  40. package/src/types/api.ts +0 -80
  41. package/src/types/client.ts +0 -88
  42. package/src/types/contract.ts +0 -21
  43. package/src/types/index.ts +0 -18
  44. package/tests/mocks/browser.ts +0 -25
  45. 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
- });