Skip to content

Commit 7ffef00

Browse files
committed
use afterEach to restore mock even if tests fail
1 parent a5e7e27 commit 7ffef00

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Diff for: __tests__/lib/github.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ function evaluate(fn) {
2525
);
2626
}
2727

28+
afterEach(function() {
29+
mock.restore();
30+
});
31+
2832
test('github', function() {
2933
mock(mockRepo.master);
3034

@@ -42,8 +46,6 @@ test('github', function() {
4246
path: 'index.js',
4347
url: 'https://github.com/foo/bar/blob/this_is_the_sha/index.js#L6-L8'
4448
});
45-
46-
mock.restore();
4749
});
4850

4951
test('malformed repository', function() {
@@ -60,8 +62,6 @@ test('malformed repository', function() {
6062
}
6163
})[0].context.github
6264
).toBe(undefined);
63-
64-
mock.restore();
6565
});
6666

6767
test('enterprise repository', function() {
@@ -82,8 +82,6 @@ test('enterprise repository', function() {
8282
url:
8383
'https://github.enterprise.com/foo/bar/blob/this_is_the_sha/index.js#L6-L8'
8484
});
85-
86-
mock.restore();
8785
});
8886

8987
test('typedef', function() {
@@ -108,6 +106,4 @@ test('typedef', function() {
108106
path: 'index.js',
109107
url: 'https://github.com/foo/bar/blob/this_is_the_sha/index.js#L1-L4'
110108
});
111-
112-
mock.restore();
113109
});

0 commit comments

Comments
 (0)