Skip to content

Commit d95622c

Browse files
committed
test: fix test case
1 parent 51e674a commit d95622c

File tree

6 files changed

+5
-7
lines changed

6 files changed

+5
-7
lines changed

package-lock.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
},
104104
"dependencies": {
105105
"chalk": "^3.0.0",
106-
"debug": "^4.1.1",
107106
"prompt": "^1.0.0"
108107
}
109108
}

src/authenticate.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import * as prompt from 'prompt';
2-
import debugFactory from 'debug';
32
import {postURLEncoded} from './util/request';
43
import {getToken, writeToken} from './token';
54
import {fromCallback} from './util/promise';
65
import {log} from './util/log';
6+
import {debug} from './util/log';
77

8-
const debug = debugFactory('fhp');
98
prompt.start();
109

1110
const defaultReadEmail = savedEmail => fromCallback<{email: string}>(cb => prompt.get({

src/upload.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import debugFactory from 'debug';
21
import {getToken} from './token';
32
import {NormalizedOptions} from './options';
43
import {LimitedConcurrent} from './util/limited-concurrent';
@@ -45,7 +44,6 @@ export class Upload {
4544
debug('upload error', err.message);
4645
// 对于鉴权错误重新鉴权
4746
if (AUTH_ERR.includes(err.errno)) {
48-
await getToken();
4947
return auth(this.options).then(() => this.uploadFileWithRetry(src, target, retry));
5048
}
5149
// 对于网络错误重试

src/util/log.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import chalk from 'chalk';
2-
import debugFactory from 'debug';
32

43
/* eslint-disable no-console */
54

test/authenticate.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ describe('邮件验证功能', () => {
7878
{source: '/foo.txt', dest: '/tmp/foo'},
7979
{source: '/bar.txt', dest: '/tmp/bar'}
8080
];
81+
readEmail = jest.fn(() => new Promise((resolve) => setTimeout(() => resolve(EMAIL), 100)));
8182
await push(tasks, {receiver, readEmail, readCode, logLevel});
8283
expect(readEmail).toBeCalledTimes(1);
8384
expect(readCode).toBeCalledTimes(1);

0 commit comments

Comments
 (0)