Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function testQueries() {
// element queries
const element = document.createElement('div');
getByText(element, 'foo');
queryByText(element, 'foo');
await findByText(element, 'foo');
getAllByText(element, 'bar');
queryAllByText(element, 'bar');
await findAllByText(element, 'bar');
// screen queries
screen.getByText('foo');
screen.queryByText('foo');
await screen.findByText('foo');
screen.getAllByText('bar');
screen.queryAllByText('bar');
await screen.findAllByText('bar');
}
beforeEach(async () => {
vm = startWebIDE(container);
await screen.findByText('README'); // wait for file tree to load
});
beforeEach(async () => {
vm = startWebIDE(container, { path: 'files/images' });
// wait for folders in left sidebar to be expanded
await screen.findByText('images');
});
it('shows empty state in the main editor window', async () => {
expect(
await screen.findByText(
"Select a file from the left sidebar to begin editing. Afterwards, you'll be able to commit your changes.",
),
).toBeDefined();
});
});
it('shows "No files" in the left sidebar', async () => {
expect(await screen.findByText('No files')).toBeDefined();
});
it('shows download viewer', async () => {
const downloadButton = await screen.findByText('Download');
expect(downloadButton.getAttribute('download')).toEqual('Gemfile.zip');
expect(downloadButton.getAttribute('href')).toContain('/raw/');
});
});