Ingo Richter

6 minute read

Let’s start with a bold statement: We all love to write unit great tests for our code. More or less. – Unknown Programmer Writing unit tests for my code mostly follows this pattern Write a test and make it fail (red) Write the function to fix the test (implement function) Start over with step 1 For one of my projects I was using jest. It’s fast now and it has several features that I highly value.

1 minute read

TIL - SIGINFO is awesome Today I learnt something really awesome. If you use a Unix based operating system, then you will be able to send any process a signal. This might be either Ctrl+C or SIGINT to interrupt that process. Or you can send SIGINFO to report the progress of it’s operation. Why this is awesome? Did you ever copy a huge amount of data and cp didn’t tell you how much has data has been copied so far?

1 minute read

I was building a Reactjs component, that should toggle between two child components. <Toggle> <Comp1> <Comp2> </Toggle> The render method of Toggle looked like this render() { const content = React.Children.count(this.props.children) > 0 ? this.props.children[0] : this.props.children[1]; return ( ${content} ); } Unfortunately, this didn’t work (index out of bounds), when I passed only one component instead of two. This doesn’t make sense, since the Toggle is supposed to toggle between two components.