This repository has been archived by the owner on Nov 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
test.js
67 lines (58 loc) · 2.13 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import test from 'ava';
import m from '.';
const ora = string => {
if (string) {
console.log(string);
}
return {
start(string) {
if (string) {
console.log(string);
}
return this;
},
stop() {},
succeed(string) {
if (string) {
console.log(string);
}
},
warn() {},
};
};
test('fetches commits and PRs', async t => {
// AurelienLourot had the following activity:
// * 2017-08-26: nothing
// * 2017-08-27: 14 commits in AurelienLourot/mybeir.ut
// * 2017-08-28: 1 PR in tt-gf/ant-ivy
const result = await m.fetch('AurelienLourot', '2017-08-26', '2017-08-28', ora, console);
// Because AurelienLourot had no activity on 2017-08-26, GitHub chooses to display older activity
// on his profile, namely a PR for `brandon-rhodes/uncommitted` on 2017-07-08 and some commits to
// `AurelienLourot/myberl.in`. This is a known limitation and we think it's better to discover too
// much than not enough.
t.is(result.size, 4);
t.true(result.has('AurelienLourot/mybeir.ut'));
t.true(result.has('tt-gf/ant-ivy'));
t.true(result.has('brandon-rhodes/uncommitted'));
t.true(result.has('AurelienLourot/myberl.in'));
});
test('fetches issues and reviewed pull requests', async t => {
// RichardLitt had the following activity:
// * 2018-08-07: 1 issue in orbitdb/welcome
// 4 reviewed pull requests in readthedocs/readthedocs.org
const result = await m.fetch('RichardLitt', '2018-08-07', '2018-08-07', ora, console, true);
t.is(result.size, 2);
t.true(result.has('orbitdb/welcome'));
t.true(result.has('readthedocs/readthedocs.org'));
});
test('fetches hot issues', async t => {
// Hot issues are issues which received more comments than others.
//
// AurelienLourot had the following activity:
// * 2015-09-23: 1 commit in AurelienLourot/AurelienLourot.github.io
// 1 hot issue in jfrog/build-info
const result = await m.fetch('AurelienLourot', '2015-09-23', '2015-09-23', ora, console, true);
t.is(result.size, 2);
t.true(result.has('AurelienLourot/AurelienLourot.github.io'));
t.true(result.has('jfrog/build-info'));
});