0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00
logto/packages/connector-aliyun-dm/src/single-send-mail.test.ts
Darcy Ye 54b62094c8
feat(core): wrap aliyun direct mail connector (#660)
* feat(core): wrap aliyun direct mail connector

* feat(core): remove copyfiles and reorganize files
2022-04-26 19:32:41 +08:00

26 lines
814 B
TypeScript

import { singleSendMail } from './single-send-mail';
import { request } from './utils';
jest.mock('./utils');
describe('singleSendMail', () => {
it('should call request with action SingleSendMail', async () => {
await singleSendMail(
{
AccessKeyId: '<access-key-id>',
AccountName: 'noreply@example.com',
AddressType: '1',
FromAlias: 'CompanyName',
HtmlBody: 'test from logto',
ReplyToAddress: 'false',
Subject: 'test',
ToAddress: 'user@example.com',
},
'<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', 'SingleSendMail');
});
});