~statianzo/angularjs-testing-library

caee06593793f42b14ec746ece90118d515516fa — Jason Staten 4 years ago 78021a6
fix(test): debug tests pass
1 files changed, 16 insertions(+), 8 deletions(-)

M src/__tests__/debug.js
M src/__tests__/debug.js => src/__tests__/debug.js +16 -8
@@ 1,4 1,5 @@
import React from 'react'
import angular from 'angular'
import 'angular-mocks'
import {render} from '../'

beforeEach(() => {


@@ 9,9 10,16 @@ afterEach(() => {
  console.log.mockRestore()
})

beforeEach(() => {
  angular.module('atl', [])
  angular.mock.module('atl')
})

test('debug pretty prints the container', () => {
  const HelloWorld = () => <h1>Hello World</h1>
  const {debug} = render(<HelloWorld />)
  angular.module('atl').component('atlHelloWorld', {
    template: `<h1>Hello World</h1>`,
  })
  const {debug} = render(`<atl-hello-world></atl-hello-world>`)
  debug()
  expect(console.log).toHaveBeenCalledTimes(1)
  expect(console.log).toHaveBeenCalledWith(


@@ 20,13 28,13 @@ test('debug pretty prints the container', () => {
})

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>
    </>
  )
  const {getAllByTestId, debug} = render(<HelloWorld />)
    `,
  })
  const {getAllByTestId, debug} = render(`<atl-hello-world></atl-hello-world>`)
  const multipleElements = getAllByTestId('testId')
  debug(multipleElements)