some tests
This commit is contained in:
Родитель
5836f8f612
Коммит
e8b36f3323
|
@ -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 () {
|
||||
|
|
Загрузка…
Ссылка в новой задаче