Mocking Vuex in Storybook and Vue Test Utils

tl;dr: Scroll down to Conclusion immediately

  • In Storybook, each story is a new Vue app
    register Vuex plugin on Vue prototype
  • In Vue Test Utils, each test reuses the existing Vue constructor
    register Vuex plugin on local Vue instance

This blog post demonstrates how to set up a simple unit test and story for a component that is connected to a Vuex store. These components usually are smart/container components.

In my current project assignment I have the honor to help 4 teams starting to improve code quality and to release more often. Unfortunately there are not a lot of dumb components, which are easier to test and to write stories for.

There is no safety net (tests + stories) created yet, so refactoring is kind of risky. The perfect Chicken and Egg problem! How can I still test these components? How do I mock the Vuex store?

Read more →

Advent of Code, day 24 + 25: Think out of the box

Bugs in recursion

Lets first talk about Day 24 – “Planet of Discord”. This puzzle reminded me of the fascinating Conway’s Game of Life that dates back to 1970.

Part one was about finding a repeating pattern in the ever-changing constellation of bugs. Now my loop detector that I had prepared earlier on day 12 to solve “The N-Body Problem” came in handy. So this part was quickly resolved. So let’s continue with the typical more advanced part.

Read more →

Advent of Code, day 23: The network is reliable

We’re almost there, just two more days to go. Yesterday’s puzzle was a difficult one. In fact, it is my first one I didn’t finish on the day I started it. Even worse, I have yet to get my second star. I guess my modular arithmetic needs some brushing up… So I was glad to see an easier puzzle today. And it was another IntCode one, the 11th time this year already.

After having repaired our ship, we now have to rebuild the network from scratch. There are 50 computers that are all running the IntCode program. They send each other packets using the output and input instructions. That sounds familiar, right? We’ve already connected 5 amps together. But the twist here is that any computer can send to any other computer, and more importantly, the in- and outputs are non-blocking. So how does my IntCode implementation hold up?

Read more →

Advent of Code Day 20: a little bit of (re)vision

Coder’s log, AoC-stardate 2019.40. With help of the tractor beam we have managed to escape the security perimeter of the planet called Neptune. We have landed on Sol IX, nearby a donut-shaped structure. It appears to have a maze-like interior that we need to cross….

Except that I am terribly behind on collecting stars for the previous days, not to mention that our financial controller just mailed: “enter your expenses regarding 2019 as soon as possible . Time for… more procrastination, and a small look back and forth.

Read more →

Package management with Nix

As software engineers we use package managers on a daily basis. We use them to install dependencies we need to run and build software we write. Probably every software engineer can relate to the frustration that will eventually arise from using these package managers. Sometimes packages that seem to work on your colleagues machine just fine, are broken on yours. Even though package managers have improved substantially over time, issues like these still arise. Maybe there is some fundamental design flaw in the way we approach package management. There is a package manager that tries to do things different and it is called Nix. Let’s take a look at what Nix is and how you can use it on your machine today.

Read more →

How little green men helped me solve a puzzle

Okay, so first of all it is all Serge’s fault. On the train back from Schiphol he introduced me to http://www.adventofcode.com and together we solved the first puzzle, which also marked my first steps into Python.

I was hooked instantly.

Every year I try to learn at least one new language or skill, but the last few years it felt like cheating. First I learned AppleScript then Blender and last summer I settled for kOS scripting, interesting, but not very deep and most of all not very practical. Python proved to be something else. It reminded me of C, Pascal, Bash and everything else. It seemed to come very naturally and at the same time it continued to surprise me with simple constructs that allow you to do things elegantly and efficiently.

Read more →