use chai, err needs to be null, not just undefined