Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

api.test.js 1.2 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const assert = require("assert");
  2. const { createFingerprint, createHmac } = require("../src");
  3. describe("api", () => {
  4. it("createHmac", () =>
  5. createHmac("sha256", "password").then((fingerprint) => {
  6. assert.equal(
  7. "e56a207acd1e6714735487c199c6f095844b7cc8e5971d86c003a7b6f36ef51e",
  8. fingerprint
  9. );
  10. }));
  11. it("createHmac and update", () =>
  12. createHmac("sha256", "password", "salt").then((fingerprint) => {
  13. assert.equal(
  14. "fc328232993ff34ca56631e4a101d60393cad12171997ee0b562bf7852b2fed0",
  15. fingerprint
  16. );
  17. }));
  18. it("fingerprint is length of 3", () => {
  19. assert.equal(
  20. createFingerprint(
  21. "e56a207acd1e6714735487c199c6f095844b7cc8e5971d86c003a7b6f36ef51e"
  22. ).length,
  23. 3
  24. );
  25. });
  26. it("fingerprint is length of 3", () => {
  27. const expectedFingerprint = [
  28. {
  29. color: "#FFB5DA",
  30. icon: "fa-flask",
  31. },
  32. {
  33. color: "#009191",
  34. icon: "fa-archive",
  35. },
  36. {
  37. color: "#B5DAFE",
  38. icon: "fa-beer",
  39. },
  40. ];
  41. assert.deepEqual(
  42. createFingerprint(
  43. "e56a207acd1e6714735487c199c6f095844b7cc8e5971d86c003a7b6f36ef51e"
  44. ),
  45. expectedFingerprint
  46. );
  47. });
  48. });