LearningSalesForceCommerceC.../storefront-reference-architecture/test/mocks/helpers/renderTemplateHelper.js

33 lines
797 B
JavaScript
Raw Normal View History

2021-12-21 10:57:31 -08:00
'use strict';
// mocking ~/cartridge/scripts/renderTemplateHelper
var proxyquire = require('proxyquire').noCallThru().noPreserveCache();
var sinon = require('sinon');
var templateStub = sinon.stub();
templateStub.returns({
render: function () {
return { text: 'rendered html' };
}
});
function proxyModel() {
return proxyquire('../../../cartridges/app_storefront_base/cartridge/scripts/renderTemplateHelper', {
'dw/util/Template': templateStub,
'dw/util/HashMap': function () {
return {
result: {},
put: function (key, context) {
this.result[key] = context;
}
};
}
});
}
module.exports = {
templateStub: templateStub,
proxyModel: proxyModel
};