import {createConfirmationModal } from ‘/form.js’;
I’m trying to write unit test cases for my code, but unable to write it
this.store.on('auth:signout:submit', async () => {
const { pathname } = this.store.location;
const pagePath = `${this.store.hrefRoot}/my-account/orders`;
if (pathname === pagePath ) {
this.ordersWarningModal(pathname);
} else {
this.orders(pathname);
}
});
async pagePathWarningModal(pathname) {
const ph = await getPlaceholders();
const onConfirm = async () => {
this.onSignOutPage(pathname);
};
try {
await createConfirmationModal({
onConfirm,
title: ph.Delete,
confirmText: ph.leave,
abortText: ph.cancel,
});
} catch (e) {
log.error('failed to open a modal: ', e);
}
}
async onSignOutPage(pathname) {
localStorage.removeItem(Hello_var);
}
Here the createConfirmationModal is the function, to create a modals.
How to write the unit test cases for this js code where i can test if the modal is opened in pagepath and check with proper titles