quintilesims / slackbot

Slack bot for IQVIA
MIT License
2 stars 0 forks source link

Add meaningful test case names to table tests #53

Open zpatrick opened 6 years ago

zpatrick commented 6 years ago

A lot of tables tests don't have names associated with each test case, which makes it difficult to know exactly why that test case is expected to do whatever it's meant to do. A good example is TestInterviewCommandErrors:

func TestInterviewAddErrors(t *testing.T) {
    inputs := []string{
        "!interview add",
        "!interview add NAME",
        "!interview add NAME 03/15/2006",
        "!interview add NAME 03/15/2006 09:00am",
        "!interview add NAME 03/15/2006 09:00am uname",
        "!interview add NAME 03/15/2006 09:00am @uname",
        "!interview add NAME 15/03/2006 09:00am <@uid>",
        "!interview add NAME 3/15/2006 09:00am <@uid>",
        "!interview add NAME 03/15/06 09:00am <@uid>",
        "!interview add NAME 03/15/2006 9 <@uid>",
        "!interview add NAME 03/15/2006 9am <@uid>",
        "!interview add NAME 03/15/2006 9:00am <@uid>",
        "!interview add NAME 03/15/2006 09:00 <@uid>",
    }

It would be better to have something like:

inputs := map[string]string{
    "missing NAME argument": "!interview add",
    ...
}

I think we should standardize on requiring all table tests to have a name associated with each case.