Skip to content

Instantly share code, notes, and snippets.

@skayred
Created August 13, 2019 10:03
Show Gist options
  • Save skayred/5d189300d2a23a33d15210eceeba554c to your computer and use it in GitHub Desktop.
Save skayred/5d189300d2a23a33d15210eceeba554c to your computer and use it in GitHub Desktop.
import {toBeInTheDocument, toHaveClass} from '@testing-library/jest-dom'
expect.extend({toBeInTheDocument, toHaveClass});
import {
getByLabelText,
getByText,
getByTestId,
queryByTestId,
wait,
waitForDomChange,
// fireEvent,
querySelector
} from '@testing-library/dom'
import '@testing-library/jest-dom/extend-expect'
beforeEach(() => {
var html = require('fs').readFileSync('./index.html').toString();
global.document.documentElement.innerHTML = html;
require('./index');
});
it("renders_container", () => {
expect(
document.getElementById('board'),
).toBeInTheDocument()
});
it("renders_table", async () => {
waitForDomChange();
console.log(global.document.documentElement.innerHTML);
console.log(document.documentElement.innerHTML);
expect(
document.documentElement.getElementsByTagName('td').length,
).toEqual(5*5);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment