Any reason you only attach the errors array if there's at least one error?

IMO it should always be created when you mock the prompt. This way the value is predictable and always the same type. - Plus you'd remove unnecessary nesting and logic.