Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('renders a zoid component', () => {
contingencyFlow.start('https://example.com?cart_id=abc123&action=action&xcomponent=1&flow=contingency');
td.verify(fakeContingencyInit({
action: 'action',
xcomponent: '1',
flow: 'contingency',
cart_id: 'abc123',
onContingencyResult: td.matchers.isA(Function),
onError: td.matchers.isA(Function)
}));
td.verify(fakeContingencyComponentRender(document.body));
});
return HostedFields.render(renderOptions, '#button2').then((handler) => {
td.replace(handler, 'submit');
td.when(handler.submit()).thenResolve();
btn.click();
td.verify(handler.submit());
});
});
return HostedFields.render(renderOptions, '#button2').then(() => {
td.verify(btn.addEventListener('click', td.matchers.isA(Function)));
});
});
return client.HostedFields.render(renderOptions).then(() => {
td.verify(btClientCreate({
authorization: 'PROD',
configuration: td.matchers.isA(Object)
}));
td.verify(hostedFieldsCreate({
client: fakeBtClient,
paymentsSdk: true
}));
});
});
return HostedFields.render(renderOptions, '#button').then(rejectIfResolves).catch((err) => {
td.verify(hostedFieldsCreate(td.matchers.anything()), {
times: 0
});
assert.equal(err, error);
});
});
}).then(() => {
td.verify(fakeHostedFieldsInstance.tokenize({
orderId: 'order-id'
}));
});
});
}).then(() => {
td.verify(fakeHostedFieldsInstance.tokenize({
orderId: 'order-id',
billingAddress: {
postalCode: '60654'
}
}));
});
});
setTimeout(() => {
td.verify(renderOptions.onApprove(tokenizationData));
done();
}, 100);
}).catch(done);
setTimeout(() => {
td.verify(renderOptions.onError(error));
done();
}, 100);
}).catch(done);