Blog2014 ≫ Got the tests passing in the new version of my robot butler

Rah been struggling for ages with the new version of my lightwaverf code1, because I started to write some tests a long time ago and then each time I revisit it to make them pass I forget what I was originally trying to test. I figured it out last night, I want to change the format of the config file, and I don't want it to break... so there are hundreds (or maybe thousands) of people using this code, each of them has a config file that looks like this:

room:
- name: our
  device:
  - light
  - lights

and I want to change it to be like this:

room:
- name: our
  device:
  - name: light
    type: light
    status: on
  - name: lights
    type: light
    status: on

so I can store a bit more info in there about each device, which I can then use to prepopulate the robot butler2 phone app and so on. I need to make sure people who have the old config file won't stop working if they update to the new version of the code, that's what the tests are for. I'm happy now that it's all working, rah, so time to write some more tests to cover any strange edge cases.

⬅️ :: ➡️

Paul Clarke's blog - I live in A small town. Wed to Clare + father to two, I am a full-stack web engineer, + I do mostly js / Node, some ruby, python, php ect ect. I like pubbing, running, eating, home automation + other diy jiggery-pokery, history, genealogy, Television, squirrels, pirates, lego, + TIME TRAVEL.