diff --git a/package.json b/package.json index aa8d9091..04c0df2d 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "packages/*" ], "devDependencies": { - "@types/jest": "^26.0.10", + "@types/jest": "27.4.1", "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", "axios": "^0.21.4", diff --git a/packages/messaging-api-line/src/__tests__/LineClient-constructor.spec.ts b/packages/messaging-api-line/src/__tests__/LineClient-constructor.spec.ts index 5bdbcf61..96052901 100644 --- a/packages/messaging-api-line/src/__tests__/LineClient-constructor.spec.ts +++ b/packages/messaging-api-line/src/__tests__/LineClient-constructor.spec.ts @@ -26,7 +26,8 @@ describe('connect', () => { }, }, }); - LineClient.connect({ + // eslint-disable-next-line no-new + new LineClient({ accessToken: ACCESS_TOKEN, channelSecret: CHANNEL_SECRET, }); @@ -49,7 +50,8 @@ describe('connect', () => { }, }, }); - LineClient.connect({ + // eslint-disable-next-line no-new + new LineClient({ accessToken: ACCESS_TOKEN, channelSecret: CHANNEL_SECRET, origin: 'https://mydummytestserver.com', diff --git a/packages/messaging-api-line/src/__tests__/LineNotify.spec.ts b/packages/messaging-api-line/src/__tests__/LineNotify.spec.ts index e04cf14a..ad4de2b8 100644 --- a/packages/messaging-api-line/src/__tests__/LineNotify.spec.ts +++ b/packages/messaging-api-line/src/__tests__/LineNotify.spec.ts @@ -37,7 +37,8 @@ describe('connect', () => { it('create axios with LINE Notify API', () => { axios.create = jest.fn(); - LineNotify.connect({ + // eslint-disable-next-line no-new + new LineNotify({ clientId: CLIENT_ID, clientSecret: CLIENT_SECRET, redirectUri: REDIRECT_URI, diff --git a/packages/messaging-api-line/src/__tests__/LinePay.spec.ts b/packages/messaging-api-line/src/__tests__/LinePay.spec.ts index 04402871..d0c28970 100644 --- a/packages/messaging-api-line/src/__tests__/LinePay.spec.ts +++ b/packages/messaging-api-line/src/__tests__/LinePay.spec.ts @@ -31,7 +31,8 @@ describe('connect', () => { it('create axios with LINE PAY API', () => { axios.create = jest.fn(); - LinePay.connect({ + // eslint-disable-next-line no-new + new LinePay({ channelId: CHANNEL_ID, channelSecret: CHANNEL_SECRET, }); diff --git a/packages/messaging-api-messenger/src/__tests__/MessengerClient-constructor.spec.ts b/packages/messaging-api-messenger/src/__tests__/MessengerClient-constructor.spec.ts index 110850ac..9fa8c609 100644 --- a/packages/messaging-api-messenger/src/__tests__/MessengerClient-constructor.spec.ts +++ b/packages/messaging-api-messenger/src/__tests__/MessengerClient-constructor.spec.ts @@ -26,7 +26,8 @@ describe('connect', () => { }, }, }); - MessengerClient.connect({ accessToken: ACCESS_TOKEN }); + // eslint-disable-next-line no-new + new MessengerClient({ accessToken: ACCESS_TOKEN }); expect(axios.create).toBeCalledWith( expect.objectContaining({ @@ -46,7 +47,8 @@ describe('connect', () => { }, }, }); - MessengerClient.connect({ accessToken: ACCESS_TOKEN, version: '2.6' }); + // eslint-disable-next-line no-new + new MessengerClient({ accessToken: ACCESS_TOKEN, version: '2.6' }); expect(axios.create).toBeCalledWith( expect.objectContaining({ @@ -65,7 +67,8 @@ describe('connect', () => { }, }, }); - MessengerClient.connect({ + // eslint-disable-next-line no-new + new MessengerClient({ accessToken: ACCESS_TOKEN, origin: 'https://mydummytestserver.com', }); diff --git a/packages/messaging-api-slack/src/__tests__/SlackOAuthClient-constructor.spec.ts b/packages/messaging-api-slack/src/__tests__/SlackOAuthClient-constructor.spec.ts index 5595b4c9..f6aa7390 100644 --- a/packages/messaging-api-slack/src/__tests__/SlackOAuthClient-constructor.spec.ts +++ b/packages/messaging-api-slack/src/__tests__/SlackOAuthClient-constructor.spec.ts @@ -25,7 +25,8 @@ describe('connect', () => { }, }, }); - SlackOAuthClient.connect({ accessToken: TOKEN }); + // eslint-disable-next-line no-new + new SlackOAuthClient({ accessToken: TOKEN }); expect(axios.create).toBeCalledWith({ baseURL: 'https://slack.com/api/', @@ -42,7 +43,8 @@ describe('connect', () => { }, }, }); - SlackOAuthClient.connect({ + // eslint-disable-next-line no-new + new SlackOAuthClient({ accessToken: TOKEN, origin: 'https://mydummytestserver.com', }); diff --git a/packages/messaging-api-slack/src/__tests__/SlackWebhookClient-constructor.spec.ts b/packages/messaging-api-slack/src/__tests__/SlackWebhookClient-constructor.spec.ts index c9456a00..d3bc21e9 100644 --- a/packages/messaging-api-slack/src/__tests__/SlackWebhookClient-constructor.spec.ts +++ b/packages/messaging-api-slack/src/__tests__/SlackWebhookClient-constructor.spec.ts @@ -25,7 +25,8 @@ describe('connect', () => { }, }, }); - SlackWebhookClient.connect({ url: URL }); + // eslint-disable-next-line no-new + new SlackWebhookClient({ url: URL }); expect(axios.create).toBeCalledWith({ baseURL: diff --git a/packages/messaging-api-telegram/src/__tests__/TelegramClient-constructor.spec.ts b/packages/messaging-api-telegram/src/__tests__/TelegramClient-constructor.spec.ts index 06f2a172..70694ce6 100644 --- a/packages/messaging-api-telegram/src/__tests__/TelegramClient-constructor.spec.ts +++ b/packages/messaging-api-telegram/src/__tests__/TelegramClient-constructor.spec.ts @@ -33,7 +33,8 @@ describe('connect', () => { }, }, }); - TelegramClient.connect({ accessToken: ACCESS_TOKEN }); + // eslint-disable-next-line no-new + new TelegramClient({ accessToken: ACCESS_TOKEN }); expect(axios.create).toBeCalledWith({ baseURL: @@ -53,7 +54,8 @@ describe('connect', () => { }, }, }); - TelegramClient.connect({ + // eslint-disable-next-line no-new + new TelegramClient({ accessToken: ACCESS_TOKEN, origin: 'https://mydummytestserver.com', }); diff --git a/packages/messaging-api-telegram/src/__tests__/TelegramClient.spec.ts b/packages/messaging-api-telegram/src/__tests__/TelegramClient.spec.ts index ebe85ba8..47d864e3 100644 --- a/packages/messaging-api-telegram/src/__tests__/TelegramClient.spec.ts +++ b/packages/messaging-api-telegram/src/__tests__/TelegramClient.spec.ts @@ -814,12 +814,14 @@ describe('other api', () => { from_chat_id: 313534466, message_id: 203, disable_notification: true, + protect_content: true, }) .reply(200, reply); const res = await client.forwardMessage(427770117, 313534466, 203, { // @ts-expect-error disable_notification: true, + protect_content: true, }); expect(res).toEqual(result); @@ -833,11 +835,13 @@ describe('other api', () => { from_chat_id: 313534466, message_id: 203, disable_notification: true, + protect_content: true, }) .reply(200, reply); const res = await client.forwardMessage(427770117, 313534466, 203, { disableNotification: true, + protectContent: true, }); expect(res).toEqual(result); diff --git a/packages/messaging-api-viber/src/__tests__/ViberClient-constructor.spec.ts b/packages/messaging-api-viber/src/__tests__/ViberClient-constructor.spec.ts index 8852ec91..ac89af7d 100644 --- a/packages/messaging-api-viber/src/__tests__/ViberClient-constructor.spec.ts +++ b/packages/messaging-api-viber/src/__tests__/ViberClient-constructor.spec.ts @@ -30,7 +30,8 @@ describe('connect', () => { }, }, }); - ViberClient.connect({ accessToken: AUTH_TOKEN, sender: SENDER }); + // eslint-disable-next-line no-new + new ViberClient({ accessToken: AUTH_TOKEN, sender: SENDER }); expect(axios.create).toBeCalledWith({ baseURL: 'https://chatapi.viber.com/pa/', @@ -50,7 +51,8 @@ describe('connect', () => { }, }, }); - ViberClient.connect({ + // eslint-disable-next-line no-new + new ViberClient({ accessToken: AUTH_TOKEN, sender: SENDER, origin: 'https://mydummytestserver.com', diff --git a/packages/messaging-api-wechat/src/__tests__/WechatClient-constructor.spec.ts b/packages/messaging-api-wechat/src/__tests__/WechatClient-constructor.spec.ts index cbc0e7b6..326c442e 100644 --- a/packages/messaging-api-wechat/src/__tests__/WechatClient-constructor.spec.ts +++ b/packages/messaging-api-wechat/src/__tests__/WechatClient-constructor.spec.ts @@ -26,7 +26,8 @@ describe('connect', () => { }, }, }); - WechatClient.connect({ appId: APP_ID, appSecret: APP_SECRET }); + // eslint-disable-next-line no-new + new WechatClient({ appId: APP_ID, appSecret: APP_SECRET }); expect(axios.create).toBeCalledWith({ baseURL: 'https://api.weixin.qq.com/cgi-bin/', @@ -45,7 +46,8 @@ describe('connect', () => { }, }, }); - WechatClient.connect({ + // eslint-disable-next-line no-new + new WechatClient({ appId: APP_ID, appSecret: APP_SECRET, origin: 'https://mydummytestserver.com',