Skip to content

Commit

Permalink
Merge pull request #571 from github-tools/fix-tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
j-rewerts committed Jun 17, 2019
2 parents edf3270 + 5ab10bc commit 1ba01ed
Show file tree
Hide file tree
Showing 18 changed files with 125 additions and 26 deletions.
2 changes: 1 addition & 1 deletion mocha.opts
@@ -1,3 +1,3 @@
--compilers js:babel-register
--timeout 15000
--timeout 20000
--slow 5000
2 changes: 1 addition & 1 deletion test/auth.spec.js
@@ -1,7 +1,7 @@
import expect from 'must';

import Github from '../lib/GitHub';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';
import {assertSuccessful, assertFailure} from './helpers/callbacks';

describe('Github', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/error.spec.js
Expand Up @@ -3,7 +3,7 @@ import expect from 'must';
import nock from 'nock';

import Github from '../lib/GitHub';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';
import {assertSuccessful, assertFailure} from './helpers/callbacks';
import fixtureExhausted from './fixtures/repos-ratelimit-exhausted.js';
import fixtureOk from './fixtures/repos-ratelimit-ok.js';
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/record.js
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import nock from 'nock';
import path from 'path';
import GitHub from '../../lib/GitHub';
import testUser from './user.json';
import testUser from './user.js';

const gh = new GitHub();

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/repos-ratelimit-exhausted.js
Expand Up @@ -3,7 +3,7 @@ import nock from 'nock';
export default function fixture() {
let scope;
scope = nock('https://api.github.com:443', {"encodedQueryParams":true})
.get('/users/mikedeboertest/repos')
.get('/users/github-tools-test/repos')
.query({"type":"all","sort":"updated","per_page":"100"})
.reply(403, {"message":"API rate limit exceeded for 174.20.8.171. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://developer.github.com/v3/#rate-limiting"}, { server: 'GitHub.com',
date: 'Sat, 18 Jun 2016 11:50:00 GMT',
Expand Down
97 changes: 95 additions & 2 deletions test/fixtures/repos-ratelimit-ok.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions test/fixtures/user.js
@@ -0,0 +1,13 @@
let user;

if (process.env.GHTOOLS_USER) {
user = {
'USERNAME': process.env.GHTOOLS_USER,
'PASSWORD': process.env.GHTOOLS_PASSWORD,
'REPO': 'github',
'ORGANIZATION': 'github-api-tests',
};
} else {
throw new Error('No testing account set up. Please email jaredrewerts@gmail.com to get access.');
}
export default user;
6 changes: 0 additions & 6 deletions test/fixtures/user.json

This file was deleted.

4 changes: 2 additions & 2 deletions test/gist.spec.js
@@ -1,7 +1,7 @@
import expect from 'must';

import Github from '../lib/GitHub';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';
import testGist from './fixtures/gist.json';
import {assertSuccessful} from './helpers/callbacks';

Expand All @@ -22,7 +22,7 @@ describe('Gist', function() {

describe('reading', function() {
before(function() {
gist = github.getGist('f1c0f84e53aa6b98ec03');
gist = github.getGist('0ac3ef3451f4bdc9efec660ffce3e336');
});

it('should read a gist', function(done) {
Expand Down
2 changes: 1 addition & 1 deletion test/issue.spec.js
@@ -1,7 +1,7 @@
import expect from 'must';

import Github from '../lib/GitHub';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';
import wait from './helpers/wait';
import {assertSuccessful} from './helpers/callbacks';
import getTestRepoName from './helpers/getTestRepoName';
Expand Down
2 changes: 1 addition & 1 deletion test/markdown.spec.js
@@ -1,7 +1,7 @@
import expect from 'must';

import Github from '../lib/GitHub';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';

describe('Markdown', function() {
let github;
Expand Down
2 changes: 1 addition & 1 deletion test/organization.spec.js
@@ -1,7 +1,7 @@
import expect from 'must';

import Github from '../lib/GitHub';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';
import {assertSuccessful, assertArray} from './helpers/callbacks';
import getTestRepoName from './helpers/getTestRepoName';

Expand Down
2 changes: 1 addition & 1 deletion test/project.spec.js
Expand Up @@ -2,7 +2,7 @@ import expect from 'must';

import Github from '../lib/GitHub';
import wait from './helpers/wait';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';
import {assertSuccessful} from './helpers/callbacks';
import getTestRepoName from './helpers/getTestRepoName';

Expand Down
2 changes: 1 addition & 1 deletion test/rate-limit.spec.js
@@ -1,7 +1,7 @@
import expect from 'must';

import Github from '../lib/GitHub';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';
import {assertSuccessful} from './helpers/callbacks';

describe('RateLimit', function() {
Expand Down
5 changes: 2 additions & 3 deletions test/repository.spec.js
Expand Up @@ -2,7 +2,7 @@ import expect from 'must';

import Github from '../lib/GitHub';
import wait from './helpers/wait';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';
import loadImage from './fixtures/imageBlob';
import {assertSuccessful, assertFailure} from './helpers/callbacks';
import getTestRepoName from './helpers/getTestRepoName';
Expand Down Expand Up @@ -626,8 +626,7 @@ describe('Repository', function() {
treeSHA = commit.data.tree.sha;
return remoteRepo.commit(parentSHA, treeSHA, 'is this thing on?');
}).then((commit) => {
expect(commit.data.author).to.have.own('name', 'Mike de Boer');
expect(commit.data.author).to.have.own('email', 'mike@c9.io');
expect(commit.data.author).to.have.own('name', 'github-tools-test');
done();
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/search.spec.js
Expand Up @@ -2,7 +2,7 @@ import expect from 'must';
import nock from 'nock';

import Github from '../lib/GitHub';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';

describe('Search', function() {
this.timeout(20 * 1000); // eslint-disable-line no-invalid-this
Expand Down
2 changes: 1 addition & 1 deletion test/team.spec.js
@@ -1,7 +1,7 @@
import expect from 'must';

import Github from '../lib/GitHub';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';
import {assertFailure} from './helpers/callbacks';
import getTestRepoName from './helpers/getTestRepoName';

Expand Down
2 changes: 1 addition & 1 deletion test/user.spec.js
@@ -1,5 +1,5 @@
import Github from '../lib/GitHub';
import testUser from './fixtures/user.json';
import testUser from './fixtures/user.js';
import {assertSuccessful, assertArray} from './helpers/callbacks';

describe('User', function() {
Expand Down

0 comments on commit 1ba01ed

Please sign in to comment.