[MM-31547] Stop users from being able to enter the same server name or URL twice (#2049)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Devin Binnie
2022-04-19 09:31:04 -04:00
committed by GitHub
parent a26e3caf23
commit ce2ddb6a6a
6 changed files with 72 additions and 8 deletions

View File

@@ -64,6 +64,22 @@ describe('Add Server Modal', function desc() {
existing.should.be.true;
});
it('should not be valid if a server with the same name exists', async () => {
await newServerView.type('#teamNameInput', config.teams[0].name);
await newServerView.type('#teamUrlInput', 'http://example.org');
await newServerView.click('#saveNewServerModal');
const existing = await newServerView.isVisible('#teamNameInput.is-invalid');
existing.should.be.true;
});
it('should not be valid if a server with the same URL exists', async () => {
await newServerView.type('#teamNameInput', 'some-new-server');
await newServerView.type('#teamUrlInput', config.teams[0].url);
await newServerView.click('#saveNewServerModal');
const existing = await newServerView.isVisible('#teamUrlInput.is-invalid');
existing.should.be.true;
});
describe('Valid server name', async () => {
beforeEach(async () => {
await newServerView.type('#teamNameInput', 'TestTeam');