0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00
logto/packages/connector-aliyun-sms/src/single-send-text.test.ts
Darcy Ye a06d3ee73c
feat(core): wrap aliyun short message service connector (#670)
* feat(core): wrap Aliyun short message service connector

* feat(core): connectors package.json private should be FALSE

* feat(core): fix dependencies and remove query-string.stringify()
2022-04-28 14:48:18 +08:00

26 lines
789 B
TypeScript

import { mockedRandomCode } from './mock';
import { sendSms } from './single-send-text';
import { request } from './utils';
jest.mock('./utils');
describe('sendSms', () => {
it('should call request with action sendSms', async () => {
const code = mockedRandomCode;
await sendSms(
{
AccessKeyId: '<access-key-id>',
PhoneNumbers: '13912345678',
SignName: '阿里云短信测试',
TemplateCode: ' SMS_154950909',
TemplateParam: JSON.stringify({ code }),
},
'<access-key-secret>'
);
const calledData = (request as jest.MockedFunction<typeof request>).mock.calls[0];
expect(calledData).not.toBeUndefined();
const payload = calledData?.[1];
expect(payload).toHaveProperty('Action', 'SendSms');
});
});