Skip to content

Commit

Permalink
feature: validate: add support of any symbol before ":"
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Feb 3, 2023
1 parent 9c54438 commit 5f445ad
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/supertape/lib/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const getMessage = ({message, at, validations}) => [message, at, validations];

const getMessagesList = (tests) => tests.map(getMessage);
const compareMessage = (a) => ([b]) => a === b;
const SCOPE_DEFINED = /^[@\w-/\d\s]+:.*/;
const SCOPE_DEFINED = /^.*[\w-/\d\s]+:.*/;
const processedList = new Set();

const validations = {
Expand Down
27 changes: 27 additions & 0 deletions packages/supertape/lib/validator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,33 @@ test('supertape: validator: checkScopes: @', (t) => {
t.end();
});

test('supertape: validator: checkScopes: +', (t) => {
const {
createValidator,
setValidations,
} = reRequire('./validator');
const current = {
message: '+hello: world',
at: 'at',
};

const tests = [current];

setValidations({
checkScopes: true,
});

const validate = createValidator({
tests,
});

const result = validate('+hello: world');
const expected = [];

t.deepEqual(result, expected);
t.end();
});

test('supertape: validator: checkAssertionsCount', (t) => {
const {
createValidator,
Expand Down

0 comments on commit 5f445ad

Please sign in to comment.