Provision subdomain for ALL new teams, add tests

This commit is contained in:
Tom Moor
2018-11-12 14:00:23 -08:00
parent b3a8d34af3
commit c60bd4260f
5 changed files with 40 additions and 17 deletions

View File

@ -0,0 +1,19 @@
/* eslint-disable flowtype/require-valid-file-annotation */
import { flushdb } from '../test/support';
import { buildTeam } from '../test/factories';
beforeEach(flushdb);
it('should set subdomain if available', async () => {
const team = await buildTeam();
const subdomain = await team.provisionSubdomain('testy');
expect(subdomain).toEqual('testy');
expect(team.subdomain).toEqual('testy');
});
it('should set subdomain with append if unavailable', async () => {
const team = await buildTeam({ subdomain: 'myteam' });
const subdomain = await team.provisionSubdomain('myteam');
expect(subdomain).toEqual('myteam1');
expect(team.subdomain).toEqual('myteam1');
});