Tentei resolver o exercício/desafio, o teste passou mas tem um erro no console referente a unique key.
Transacoes.test.js
import React from 'react'
import { render } from '@testing-library/react'
import Transacoes from './Transacoes'
describe('Componente de transações', () => {
it('Deve renderizar uma lista de transações', () => {
const transacoes = [
{ data: '16/12/2020', tipo: 'saque', valor: '50,00' },
{ data: '26/11/2020', tipo: 'deposito', valor: '150,00' },
{ data: '10/10/2020', tipo: 'saque', valor: '100,00' }
]
const { container } = render(
<Transacoes
transacoes={transacoes}
/>)
expect(container.firstChild).toMatchSnapshot()
})
})
Erro
PASS src/transacoes/Transacoes.test.js
Componente de transações
✓ Deve renderizar uma lista de transações (7ms)
console.error node_modules/react-dom/cjs/react-dom.development.js:88
Warning: Encountered two children with the same key, `undefined-undefined`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
in div (at Transacoes.js:7)
in Transacoes (at Transacoes.test.js:15)
console.error node_modules/react-dom/cjs/react-dom.development.js:88
Warning: Encountered two children with the same key, `undefined-undefined`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
in div (at Transacoes.js:7)
in Transacoes (at Transacoes.test.js:15)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 1 passed, 1 total
Time: 0.359s, estimated 1s
Ran all test suites related to changed files.
Watch Usage: Press w to show more.