0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added check for empty name for tags

refs #10438

- Also corrected and expanded test cases for tag validation
This commit is contained in:
Nazar Gargol 2019-02-15 13:19:06 +00:00
parent 921f9d394f
commit 18921747bb
2 changed files with 5 additions and 4 deletions

View file

@ -11,6 +11,7 @@
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 191,
"pattern": "^([^,]|$)"
},

View file

@ -135,13 +135,13 @@ describe('Unit: v2/utils/validators/input/tags', function () {
describe('field formats', function () {
const fieldMap = {
name: [123, new Date(), ',starts-with-coma', _.repeat('a', 192), null],
name: [123, new Date(), ',starts-with-coma', '', _.repeat('a', 192), null],
slug: [123, new Date(), _.repeat('a', 192), null],
description: [123, new Date(), _.repeat('a', 500)],
feature_image: [123, new Date(), 'abc'],
visibility: [123, new Date(), 'abc', null],
meta_title: [123, new Date(), _.repeat('a', 301)],
meta_description: [123, new Date(), _.repeat('a', 501)],
meta_description: [123, new Date(), _.repeat('a', 501)]
};
Object.keys(fieldMap).forEach(key => {
@ -152,8 +152,8 @@ describe('Unit: v2/utils/validators/input/tags', function () {
const tag = {};
tag[key] = value;
if (key !== 'title') {
tag.title = 'abc';
if (key !== 'name') {
tag.name = 'abc';
}
const frame = {