@@ -25,6 +25,10 @@ function evaluate(fn) {
|
25 | 25 | ); |
26 | 26 | } |
27 | 27 | |
| 28 | +afterEach(function() { |
| 29 | +mock.restore(); |
| 30 | +}); |
| 31 | + |
28 | 32 | test('github', function() { |
29 | 33 | mock(mockRepo.master); |
30 | 34 | |
@@ -42,8 +46,6 @@ test('github', function() {
|
42 | 46 | path: 'index.js', |
43 | 47 | url: 'https://github.com/foo/bar/blob/this_is_the_sha/index.js#L6-L8' |
44 | 48 | }); |
45 | | - |
46 | | -mock.restore(); |
47 | 49 | }); |
48 | 50 | |
49 | 51 | test('malformed repository', function() { |
@@ -60,8 +62,6 @@ test('malformed repository', function() {
|
60 | 62 | } |
61 | 63 | })[0].context.github |
62 | 64 | ).toBe(undefined); |
63 | | - |
64 | | -mock.restore(); |
65 | 65 | }); |
66 | 66 | |
67 | 67 | test('enterprise repository', function() { |
@@ -82,6 +82,28 @@ test('enterprise repository', function() {
|
82 | 82 | url: |
83 | 83 | 'https://github.enterprise.com/foo/bar/blob/this_is_the_sha/index.js#L6-L8' |
84 | 84 | }); |
| 85 | +}); |
85 | 86 | |
86 | | -mock.restore(); |
| 87 | +test('typedef', function() { |
| 88 | +mock(mockRepo.master); |
| 89 | + |
| 90 | +expect( |
| 91 | +evaluate(function() { |
| 92 | +/** |
| 93 | + * A number, or a string containing a number. |
| 94 | + * @typedef {(number|string)} NumberLike |
| 95 | + */ |
| 96 | + |
| 97 | +/** |
| 98 | + * get one |
| 99 | + * @returns {number} one |
| 100 | + */ |
| 101 | +function getOne() { |
| 102 | +return 1; |
| 103 | +} |
| 104 | +})[0].context.github |
| 105 | +).toEqual({ |
| 106 | +path: 'index.js', |
| 107 | +url: 'https://github.com/foo/bar/blob/this_is_the_sha/index.js#L2-L5' |
| 108 | +}); |
87 | 109 | }); |