Adds simple batching

This commit is contained in:
Akshay Nair committed 2020-10-11 23:31:12 +05:30
1 parent b7741e02ff
commit 0938dff85a
2 files changed
+25 -49

No files matched your search

-40
View File
@@ -141,46 +141,6 @@ describe('Domain service', () => {
});
});
describe('setHosts', () => {
it('should resolve with a list of hosts', async () => {
const records = [
{ name: 'xx', type: 'CNAME', address: 'fck.com' },
{ name: 'xx', type: 'A', address: '111.1.1212.1' },
{ name: 'foo', type: 'URL', address: 'https://google.com' },
{ name: 'foo1', type: 'URL', address: 'https://duck.com' },
];
const addZone = jest.fn(async () => {});
const addRedir = jest.fn(async () => {});
const mockDomainService = getDomainService({ cpanel: getCpanel({ addZone, addRedir }) });
await mockDomainService.setHosts(records);
expect(addZone).toBeCalledTimes(2);
expect(addRedir).toBeCalledTimes(2);
expect(addZone.mock.calls.map(R.head)).toEqual([
{ name: 'xx', type: 'CNAME', address: 'fck.com' },
{ name: 'xx', type: 'A', address: '111.1.1212.1' },
]);
expect(addRedir.mock.calls.map(R.head)).toEqual([
{
domain: 'foo.booboo.xyz',
redirect: 'https://google.com',
redirect_wildcard: 1,
redirect_www: 0,
type: 'permanent',
},
{
domain: 'foo1.booboo.xyz',
redirect: 'https://duck.com',
redirect_wildcard: 1,
redirect_www: 0,
type: 'permanent',
},
]);
});
});
describe('updateHosts', () => {
it('should append new hosts with existing ones and set it', async () => {
const zones = [