import { newSpecPage } from "@stencil/core/testing";
import { BpSdkQuestionSetEmpty } from "./bp-sdk-question-set-empty";
const setupPage = async () => {
    return await newSpecPage({
        html: '<bp-sdk-question-set-empty></bp-sdk-question-set-empty>',
        components: [BpSdkQuestionSetEmpty],
    });
};
const setupInstance = (page) => {
    const instance = page.rootInstance;
    return instance;
};
describe('bp-sdk-question-set-empty', () => {
    it('renders default', async () => {
        const page = await setupPage();
        await page.waitForChanges();
        const element = page.root.querySelector('div');
        expect(element).toBeTruthy();
        expect(element.textContent).toContain('Thanks! There are no');
        expect(page.root.querySelector('bp-sdk-external-question-set-empty')).toBeFalsy();
    });
    it('renders external component if defined', async () => {
        const whenDefinedMock = jest.spyOn(customElements, 'whenDefined').mockResolvedValueOnce({});
        const page = await setupPage();
        setupInstance(page);
        await page.waitForChanges();
        expect(page.root.querySelector('bp-sdk-external-question-set-empty')).toBeTruthy();
        whenDefinedMock.mockRestore();
    });
});
