Skip to content

Make tests more readable and more modular #77

@seanpk

Description

@seanpk

We love tests!
And as we're getting more of them we need to mature our approach to them.

What we have for integration and unit tests needs to be refactored to be more readable and more modular.
This will improve the experience for anyone who needs to use, read, update, or write new tests.

Whatever pattern(s) get implemented to make this so, they should be applied and followed throughout all the tests. They should also be documented in (a new file) tests/README.md (which can also include instructions for running them all and examples of running only a single file).

Some examples of what we want to refactor away from:

1- the size/length of test/integration/testSwagger.js

2- test cases without sufficient description of what they're testing, e.g. (from test/integration/testSwagger.js):

    it('GET /v2/pet/1', function (done) {
        request('http://localhost:' + (process.env.PORT || 5000) + '/v2/pet/1', function (err, resp, body) {
            assert.equal(null, err);
            var json = JSON.parse(body);
            assert.equal('pets1', json.name);
            done();
        });
    });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions