fix(test): debug tests pass

ts
Jason Staten 5 years ago
parent 78021a6ab0
commit caee065937

@ -1,4 +1,5 @@
import React from 'react' import angular from 'angular'
import 'angular-mocks'
import {render} from '../' import {render} from '../'
beforeEach(() => { beforeEach(() => {
@ -9,9 +10,16 @@ afterEach(() => {
console.log.mockRestore() console.log.mockRestore()
}) })
beforeEach(() => {
angular.module('atl', [])
angular.mock.module('atl')
})
test('debug pretty prints the container', () => { test('debug pretty prints the container', () => {
const HelloWorld = () => <h1>Hello World</h1> angular.module('atl').component('atlHelloWorld', {
const {debug} = render(<HelloWorld />) template: `<h1>Hello World</h1>`,
})
const {debug} = render(`<atl-hello-world></atl-hello-world>`)
debug() debug()
expect(console.log).toHaveBeenCalledTimes(1) expect(console.log).toHaveBeenCalledTimes(1)
expect(console.log).toHaveBeenCalledWith( expect(console.log).toHaveBeenCalledWith(
@ -20,13 +28,13 @@ test('debug pretty prints the container', () => {
}) })
test('debug pretty prints multiple containers', () => { test('debug pretty prints multiple containers', () => {
const HelloWorld = () => ( angular.module('atl').component('atlHelloWorld', {
<> template: `
<h1 data-testid="testId">Hello World</h1> <h1 data-testid="testId">Hello World</h1>
<h1 data-testid="testId">Hello World</h1> <h1 data-testid="testId">Hello World</h1>
</> `,
) })
const {getAllByTestId, debug} = render(<HelloWorld />) const {getAllByTestId, debug} = render(`<atl-hello-world></atl-hello-world>`)
const multipleElements = getAllByTestId('testId') const multipleElements = getAllByTestId('testId')
debug(multipleElements) debug(multipleElements)

Loading…
Cancel
Save