Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

50 rindas
1.2 KiB

  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. });