Skip to content

Commit aaf1992

Browse files
author
Ændrew Rininsland
committed
Changed where long dash unicode test was writing. Should fix #246.
1 parent 1813b0d commit aaf1992

File tree

3 files changed

+48
-51
lines changed

3 files changed

+48
-51
lines changed

test/test.repo.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ describe('Github.Repository', function() {
9797
});
9898
});
9999

100-
var repoTest = Date.now();
100+
var repoTest = Math.floor(Math.random() * (100000 - 0)) + 0;
101101

102102
describe('Creating new Github.Repository', function() {
103103
var github = new Github({
@@ -228,10 +228,10 @@ describe('Creating new Github.Repository', function() {
228228
});
229229

230230
it('should be able to write unicode to repo', function(done) {
231-
repo.write('master', 'TEST.md', '\u2014', 'Long dash unicode', function(err) {
231+
repo.write('master', 'TEST_unicode.md', '\u2014', 'Long dash unicode', function(err) {
232232
should.not.exist(err);
233233

234-
repo.read('master', 'TEST.md', function(err, obj) {
234+
repo.read('master', 'TEST_unicode.md', function(err, obj) {
235235
should.not.exist(err);
236236
obj.should.equal('\u2014');
237237

test/test.search.js

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,59 @@
11
'use strict';
22

3-
var test = require('tape'); //jshint ignore:line
4-
var Github = require("../");
3+
// module dependencies
4+
var chai = require('chai'), sinonChai = require('sinon-chai');
5+
6+
var Github = require('../');
57
var test_user = require('./user.json');
68

7-
test("User API", function(t) {
8-
var timeout = setTimeout(function () { t.fail(); }, 100000);
9-
var github = new Github({
10-
username: test_user.USERNAME,
11-
password: test_user.PASSWORD,
12-
auth: "basic"
13-
});
14-
// var user = github.getUser();
9+
// Use should flavour for Mocha
10+
var should = chai.should();
11+
chai.use(sinonChai);
1512

13+
describe('Github.Search', function() {
14+
var github = new Github({
15+
username: test_user.USERNAME,
16+
password: test_user.PASSWORD,
17+
auth: "basic"
18+
});
1619

17-
t.test('Search.repositories', function(q) {
18-
var search = github.getSearch("tetris+language:assembly&sort=stars&order=desc");
19-
var options = null;
20+
it('should search.repositories', function(done) {
21+
var search = github.getSearch('tetris+language:assembly&sort=stars&order=desc');
22+
var options = null;
2023

21-
search.repositories(options, function (err) {
22-
q.error(err, 'search repositories');
23-
q.end();
24-
});
24+
search.repositories(options, function (err) {
25+
should.not.exist(err);
26+
done();
2527
});
28+
});
2629

27-
t.test('Search.code', function(q) {
28-
var search = github.getSearch("addClass+in:file+language:js+repo:jquery/jquery");
29-
var options = null;
30+
it('should search.code', function(done) {
31+
var search = github.getSearch('addClass+in:file+language:js+repo:jquery/jquery');
32+
var options = null;
3033

31-
search.code(options, function (err) {
32-
q.error(err, 'search code');
33-
q.end();
34-
});
34+
search.code(options, function (err) {
35+
should.not.exist(err);
36+
done();
3537
});
38+
});
3639

37-
t.test('Search.issues', function(q) {
38-
var search = github.getSearch("windows+label:bug+language:python+state:open&sort=created&order=asc");
39-
var options = null;
40+
it('should search.issues', function(done) {
41+
var search = github.getSearch('windows+label:bug+language:python+state:open&sort=created&order=asc');
42+
var options = null;
4043

41-
search.issues(options, function (err) {
42-
q.error(err, 'search issues');
43-
q.end();
44-
});
44+
search.issues(options, function (err) {
45+
should.not.exist(err);
46+
done();
4547
});
48+
});
4649

47-
t.test('Search.users', function(q) {
48-
var search = github.getSearch("tom+repos:%3E42+followers:%3E1000");
49-
var options = null;
50+
it('should search.users', function(done) {
51+
var search = github.getSearch('tom+repos:%3E42+followers:%3E1000');
52+
var options = null;
5053

51-
search.users(options, function (err) {
52-
q.error(err, 'search users');
53-
q.end();
54-
});
54+
search.users(options, function (err) {
55+
should.not.exist(err);
56+
done();
5557
});
56-
57-
58-
59-
clearTimeout(timeout);
60-
t.end();
61-
});
58+
});
59+
});

test/test.user.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ var should = chai.should();
1111
chai.use(sinonChai);
1212

1313
describe('Github.User', function() {
14+
this.timeout(8000); // Bit of a longer timeout
15+
1416
var github = new Github({
1517
username: test_user.USERNAME,
1618
password: test_user.PASSWORD,
@@ -82,8 +84,6 @@ describe('Github.User', function() {
8284
});
8385

8486
it('should show user\'s repos', function(done) {
85-
this.timeout(8000); // Bit of a longer timeout
86-
8787
user.userRepos(test_user.USERNAME, function(err) {
8888
should.not.exist(err);
8989
done();
@@ -126,8 +126,7 @@ describe('Github.User', function() {
126126
});
127127

128128
it('should create a repo', function(done) {
129-
this.timeout(8000); // Bit of a longer timeout
130-
var repoTest = Date.now();
129+
var repoTest = Math.floor(Math.random() * (100000 - 0)) + 0;
131130
var github = new Github({
132131
username: test_user.USERNAME,
133132
password: test_user.PASSWORD,

0 commit comments

Comments
 (0)