@salla.sa/twilight-components
Version:
Salla Web Component
34 lines (33 loc) • 1.13 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import { newSpecPage } from "@stencil/core/testing";
import { SallaQuickBuy } from "../salla-quick-buy";
describe('salla-quick-buy', () => {
it("should build", () => {
expect(new SallaQuickBuy()).toBeTruthy();
});
describe('rendering', () => {
it('should be able to render component', async () => {
let page = await newSpecPage({
components: [SallaQuickBuy],
html: '<salla-quick-buy></salla-quick-buy>'
});
let component = page.doc.querySelector('salla-quick-buy');
expect(component).toBeDefined();
});
it("should not handle quick buy handler for guest user", async () => {
salla.config.isGuest = () => true;
let page = await newSpecPage({
components: [SallaQuickBuy],
html: '<salla-quick-buy></salla-quick-buy>'
});
let cb = jest.fn();
salla.event.on('login::open', () => cb());
let quickBuyButton = page.doc.querySelector('salla-button');
quickBuyButton.click();
expect(cb).toHaveBeenCalled();
});
});
});
//# sourceMappingURL=salla-quick-buy.spec.js.map