Commit c630daaa authored by Flavio TARSETTI's avatar Flavio TARSETTI
Browse files

Merge branch 'db-dash-name-fix' into 'master'

Databases can no longer have names with "-" in it

Closes #147

See merge request !14
parents e8723bea 5c1f8701
Pipeline #23224 passed with stages
in 86 minutes and 3 seconds
......@@ -130,7 +130,7 @@ export const nameValidator = (be: BeatEntity, allNames?: string[] = []) => (name
}
const rxThreeSeg = /^[A-Za-z0-9_-]+\/[A-Za-z0-9_-]+\/\d+$/;
const rxTwoSeg = /^[A-Za-z0-9_-]+\/\d+$/;
const rxTwoSeg = /^[A-Za-z0-9_]+\/\d+$/;
const rxFiveSeg = /^[A-Za-z0-9_-]+\/[A-Za-z0-9_-]+\/[A-Za-z0-9_-]+\/\d+\/[A-Za-z0-9_-]+$/;
if(be !== 'database' && be !== 'experiment' && !rxThreeSeg.test(name))
return false;
......
// @flow
import { expect } from 'chai';
import sinon from 'sinon';
import { spies } from '@test';
import { nameValidator } from './beat.js';
describe('nameValidator', () => {
describe('database names', () => {
let be = 'database';
let otherNames = [];
it('should not accept names with a "-" character', () => {
expect(nameValidator(be, otherNames)('replay-me/1')).to.equal(false);
});
it('should accept names with a "_" character', () => {
expect(nameValidator(be, otherNames)('replay_me/1')).to.equal(true);
});
it('should accept names with only ascii characters', () => {
expect(nameValidator(be, otherNames)('replayme/1')).to.equal(true);
});
});
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment