On Wed, May 6, 2020 at 9:13 AM Roy Lenferink <rlenfer...@apache.org> wrote:
>
> I gave it a try and succeeded :)
>
> https://github.com/rubys/whimsy-board-agenda-nodejs/commit/e5bbdb763739d8f0b658a0f7af790c3bbd798b31
>
> At first I thought I was going to be overwhelmed but in the end it was quite 
> easy to convert from
> the current board agenda to the Node.js solution.

Here's a test case for the new function:

https://github.com/rubys/whimsy-board-agenda-nodejs/blob/ea49900b865d3871f40ac92b75a3b1a63b60a33f/src/client/__tests__/cve.js

Explanation:

Report is a component that renders a report.  It expects as input an
item from the agenda and accesses the redux store for information that
is unrelated to what is needed to test this function.

So you need to provide an item and a store.  In this case, you want an
item that contains text that will trigger the filter, and the store
can be empty.

The Report component builds a list of filters and calls the Text
component to apply those filters.  The Text component then make use of
React's https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
function.

Even with all this background, I find the test to be delightfully
straightforward.

You run tests with the "yarn test" command.  If you keep that window
open, the tests will automatically rerun every time you make a source
code change.

- Sam Ruby

Reply via email to