ohartman / React-Playground

0 stars 0 forks source link

tests for dog component #8

Open tgrecojs opened 1 month ago

tgrecojs commented 1 month ago

Tasks

Unit tests

https://github.com/ohartman/React-Playground/blob/b20983ecc844da4067eda24d070e58505a52859b/src/image.jsx#L1-L22

tgrecojs commented 1 month ago

https://medium.com/javascript-scene/tdd-the-rite-way-53c9b46f45e3

tgrecojs commented 1 month ago

from https://github.com/paralleldrive/riteway

import React from 'react';
import render from 'riteway/render-component';
import { describe } from 'riteway';

describe('renderComponent', async assert => {
  const $ = render(<div className="foo">testing</div>);

  assert({
    given: 'some jsx',
    should: 'render markup',
    actual: $('.foo').html().trim(),
    expected: 'testing'
  });
});