This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/server/models/Team.test.js
Tom Moor bad8718a6b 💚
2018-11-12 14:53:32 -08:00

29 lines
976 B
JavaScript

/* 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 () => {
await buildTeam({ subdomain: 'myteam' });
const team = await buildTeam();
const subdomain = await team.provisionSubdomain('myteam');
expect(subdomain).toEqual('myteam1');
expect(team.subdomain).toEqual('myteam1');
});
it('should do nothing if subdomain already set', async () => {
const team = await buildTeam({ subdomain: 'example' });
const subdomain = await team.provisionSubdomain('myteam');
expect(subdomain).toEqual('example');
expect(team.subdomain).toEqual('example');
});