Commit 5c1f8701 authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH
Browse files

[js][db] will no longer accept db names with "-" in it, fixes #147

parent e8723bea
Pipeline #23050 passed with stages
in 74 minutes and 55 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