We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af1e9b9 commit 2920a26Copy full SHA for 2920a26
spec/modifiers/default.spec.js
@@ -0,0 +1,24 @@
1
+var valid = require('../../lib/modifiers/default');
2
+
3
+const model = {
4
+ default: 'default value'
5
+};
6
7
+describe(' - Default modifier', () => {
8
+ it('shall be a function', () => {
9
+ expect(typeof valid).toEqual('function');
10
+ });
11
12
+ it('shall not modify data when no model set', () => {
13
+ expect(valid('validData', {})).toEqual(null);
14
+ expect(valid(undefined, {})).toEqual(null);
15
16
17
+ it('shall not modify data if exists and model set', () => {
18
+ expect(valid('validData', model)).toEqual(null);
19
20
21
+ it('shall return the default value when not data and model set', () => {
22
+ expect(valid(undefined, model)).toEqual(model.default);
23
24
+});
0 commit comments