import { newSpecPage } from "@stencil/core/testing";
import { BpSdkPendingProcessContainer } from "./bp-sdk-pending-process-container";
const setupPage = async () => {
    return await newSpecPage({
        html: '<bp-sdk-pending-process-container></bp-sdk-pending-process-container>',
        components: [BpSdkPendingProcessContainer],
    });
};
const setupInstance = (page) => {
    const instance = page.rootInstance;
    instance.pendingProcesses = [];
    return instance;
};
describe('bp-sdk-pending-process-container', () => {
    it('renders', async () => {
        const page = await setupPage();
        setupInstance(page);
        await page.waitForChanges();
        const element = page.root.querySelector('div');
        expect(element).toBeTruthy();
        expect(page.root.querySelector('bp-sdk-external-pending-process-container')).toBeFalsy();
    });
    it('renders external component if defined', async () => {
        jest.spyOn(customElements, 'whenDefined').mockReturnValueOnce(Promise.resolve());
        const page = await setupPage();
        await page.waitForChanges();
        expect(page.root.querySelector('bp-sdk-external-pending-process-container')).toBeTruthy();
    });
});
