From 673a2259ceb656435e71609762ceab1d704e24ca Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 29 Nov 2023 21:57:13 +0800 Subject: [PATCH] feat: remove outdated test case --- lib/v2/twitter/web-api/twitter-api.js | 4 ++++ test/config.js | 14 -------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/v2/twitter/web-api/twitter-api.js b/lib/v2/twitter/web-api/twitter-api.js index 2faae7f69..673bbb208 100644 --- a/lib/v2/twitter/web-api/twitter-api.js +++ b/lib/v2/twitter/web-api/twitter-api.js @@ -9,6 +9,10 @@ const queryString = require('query-string'); let tokenIndex = 0; const twitterGot = async (url, params) => { + if (!config.twitter.oauthTokens.length || !config.twitter.oauthTokenSecrets.length || config.twitter.oauthTokens.length !== config.twitter.oauthTokenSecrets.length) { + throw Error('Invalid twitter oauth tokens'); + } + const oauth = OAuth({ consumer: { key: consumerKey, diff --git a/test/config.js b/test/config.js index 145068ee0..3fcf7da3d 100644 --- a/test/config.js +++ b/test/config.js @@ -17,20 +17,6 @@ describe('config', () => { delete process.env.BILIBILI_COOKIE_34; }); - it('twitter token', () => { - process.env.TWITTER_TOKEN_12 = 'token1'; - process.env.TWITTER_TOKEN_34 = 'token2'; - - const config = require('../lib/config').value; - expect(config.twitter.tokens).toMatchObject({ - 12: 'token1', - 34: 'token2', - }); - - delete process.env.TWITTER_TOKEN_12; - delete process.env.TWITTER_TOKEN_34; - }); - it('email config', () => { process.env['EMAIL_CONFIG_xx.qq.com'] = 'token1'; process.env['EMAIL_CONFIG_oo.qq.com'] = 'token2';