Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We need tests #13

Open
syvb opened this issue Nov 30, 2017 · 1 comment
Open

We need tests #13

syvb opened this issue Nov 30, 2017 · 1 comment

Comments

@syvb
Copy link
Collaborator

syvb commented Nov 30, 2017

We should run tests on every PR, before Chaosbot can merge them.

@mdcfe
Copy link

mdcfe commented Dec 2, 2017

To facilitate testing, we should separate out lookAtPrs into multiple separate functions that perform single tasks, possibly into separate files as well.

I'd personally suggest Jest as a framework as it's easy to pick up, and we could use Travis to run the tests before allowing the PR to be merged.

In addition, we could clean up the code by moving to using async functions and awaiting promises instead of using .then, for example changing this:

function lookAtPrs() {
    repo.listPullRequests({
        state: "open",
        base: "master" //ignore non-master PRs
    }).then(function (prs) {
        prs = prs.data;
        // ...
    }
}
lookAtPrs()

to this:

async function lookAtPrs() {
    let prs = await repo.listPullRequests({
        state: "open",
        base: "master" //ignore non-master PRs
    });
    prs = prs.data;
    // ...
}
await lookAtPrs();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants