dw-api-mock
dw-api-mock copied to clipboard
Infinite Loop
I am trying to make it work with Jest. Every time I require this into my simple test it goes into an infinite loop. While debugging I also saw that it is throwing an exception on line 70.
demandware-globals.js
#!javascript
try {
// the line below is throwing exception TypeError: require is not a constructor
global[pathArray[0]][pathArray[1]][pathArray[2]] = require("./"+classPath);
} catch(e){
console.log("Could not require "+classPath+e);
}
My test:
#!javascript
'use strict'
require('dw-api-mock/demandware-globals');
describe('COBilling',() => {
describe('SelectCreditCard',() => {
it('should call the method on Cybersource to save the card', () => {
expect(2).toBe(2);
});
});
});