You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 години
1234567891011121314151617181920
  1. const {
  2. stringToArrayBuffer,
  3. arrayBufferToHex,
  4. getAlgorithm,
  5. } = require("./index");
  6. test("stringToArrayBuffer", () => {
  7. expect(stringToArrayBuffer("ȧ")[0]).toBe(200);
  8. expect(stringToArrayBuffer("ȧ")[1]).toBe(167);
  9. });
  10. test("arrayBufferToHex", () => {
  11. expect(arrayBufferToHex(new Uint8Array([200, 167]))).toBe("c8a7");
  12. });
  13. test("getAlgorithm", () => {
  14. expect(getAlgorithm("sha-256")).toBe("SHA-256");
  15. expect(getAlgorithm("sha256")).toBe("SHA-256");
  16. expect(getAlgorithm("ShA-256")).toBe("SHA-256");
  17. });