This commit is contained in:
Ali Hamud 2017-08-24 16:58:17 +03:00
Родитель 5836f8f612
Коммит e8b36f3323
2 изменённых файлов: 44 добавлений и 1 удалений

Просмотреть файл

@ -5,7 +5,8 @@
"name": {
"type": "string",
"messages": {
"type": "name must be a string"
"type": "name must be a string",
"required": "name is required"
}
},
"extend": {

Просмотреть файл

@ -817,6 +817,48 @@ describe('Unit | Models', function () {
expect(errors).toBeUndefined();
});
});
describe('validate Extensions', function () {
const commandNameInvalidTypeMessage = models.extensionItemSchema.properties.name.messages.type;
const commandNameRequiredMessage = models.extensionItemSchema.properties.name.messages.required;
it(`should return errors with one containing message '${commandNameInvalidTypeMessage}' if command name is not a string`, function () {
// Arrange
const testData = {
extensions: {
command: {
name: true,
title: "title",
extend: {}
}
}
};
// Act
const errors = models.validateExtension(testData.extensions);
// Assert
testForExpectedMessage(errors, commandNameInvalidTypeMessage);
});
it(`should return errors with one containing message '${commandNameRequiredMessage}' if command name is not a provided`, function () {
// Arrange
const testData = {
extensions: {
command: {
title: "title",
extend: {}
}
}
};
// Act
const errors = models.validateExtension(testData.extensions);
// Assert
testForExpectedMessage(errors, commandNameRequiredMessage);
});
});
});
describe("Unit | Filters", function () {