domain: split the config and wellknown routes

we want to add more stuff to the UI like the jitsi URL
This commit is contained in:
Girish Ramakrishnan
2021-12-03 13:46:54 -08:00
parent 5592dc8a42
commit 39807e6ba4
8 changed files with 107 additions and 41 deletions
+12 -2
View File
@@ -52,12 +52,12 @@ describe('Domains', function () {
expect(result).to.be(null);
});
it('can update domain', async function () {
it('can set domain config', async function () {
const newConfig = {};
const newTlsConfig = { provider: 'letsencrypt-staging' };
const newDomain = Object.assign({}, DOMAIN_0, { config: newConfig, tlsConfig: newTlsConfig });
await domains.update(DOMAIN_0.domain, newDomain, auditSource);
await domains.setConfig(DOMAIN_0.domain, newDomain, auditSource);
const result = await domains.get(DOMAIN_0.domain);
expect(result.domain).to.equal(DOMAIN_0.domain);
@@ -70,6 +70,16 @@ describe('Domains', function () {
DOMAIN_0.tlsConfig = newTlsConfig;
});
it('can set domain wellknown', async function () {
await domains.setWellKnown(DOMAIN_0.domain, { service: 'some.service' }, auditSource);
let result = await domains.get(DOMAIN_0.domain);
expect(result.wellKnown).to.eql({ service: 'some.service' });
await domains.setWellKnown(DOMAIN_0.domain, null, auditSource);
result = await domains.get(DOMAIN_0.domain);
expect(result.wellKnown).to.eql(null);
});
it('can get all domains', async function () {
const result = await domains.list();
expect(result.length).to.equal(2);