mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
a06d3ee73c
* 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()
26 lines
789 B
TypeScript
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');
|
|
});
|
|
});
|