I am getting below error while using jest to test. I'm using a non es6 npm package here. The issue happens when I do not want to do any wildcard * imports. I wanted to do explicit imports.
//code
import sha256 from "crypto-js/sha256";
export const GetHashToken = (value) => {
return sha256(value);
};
//test
import { GetHashToken, GetUtcTimeStamp } from
"../../utils/ScheduleRepairUtility";
describe("Get hash token utility", () => {
it("Should return sha-256 hex digit string for given value", () => {
const paramValue = "78436783465sears121212";
expect(GetHashToken(paramValue))
.toBe("b87663752c7f5bf0967f74fd3523dece543
f447e96d9b1d478c7336781e1828b");
});
});
Getting error:
● Get hash token utility › Should return sha-256 hex digit string for
given value
TypeError: sha256_1.default is not a function
I'm using react-typescript for my project. Any help is appreciated.
Thanks!!