@wmfs/json-to-vuelidate 1.22.3 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # [1.23.0](https://github.com/wmfs/json-to-vuelidate/compare/v1.22.3...v1.23.0) (2021-12-09)
2
+
3
+
4
+ ### 🛠 Builds
5
+
6
+ * **deps-dev:** update dependency semantic-release to v18.0.1 ([4fed5c6](https://github.com/wmfs/json-to-vuelidate/commit/4fed5c6439b66e3de4d339f30954dcc9edb149ac))
7
+ * **deps-dev:** update semantic-release monorepo ([8ca62db](https://github.com/wmfs/json-to-vuelidate/commit/8ca62dbb892ff384edb65ee1936f82e324a851bb))
8
+ * **deps:** update dependency vuelidate to v0.7.7 ([aedd1af](https://github.com/wmfs/json-to-vuelidate/commit/aedd1af0bf754447ec98f35eaf09904cb0576e9d))
9
+
10
+
11
+ ### 🚨 Tests
12
+
13
+ * better labels for comparing min/max dates ([ccc5f43](https://github.com/wmfs/json-to-vuelidate/commit/ccc5f434c4ae9142ade2c7c62db7bf65a8915df9))
14
+ * enhance tests for min/max dates ([72ea867](https://github.com/wmfs/json-to-vuelidate/commit/72ea867adeaf4487927b33ae50fe894c6c030bb7))
15
+
1
16
  ## [1.22.3](https://github.com/wmfs/json-to-vuelidate/compare/v1.22.2...v1.22.3) (2021-10-27)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wmfs/json-to-vuelidate",
3
3
  "description": "Takes in a JSON object and products an object of vuelidate expressions.",
4
- "version": "1.22.3",
4
+ "version": "1.23.0",
5
5
  "author": "West Midlands Fire Service",
6
6
  "keywords": [
7
7
  "tymly",
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "main": "./lib/index.js",
11
11
  "dependencies": {
12
- "vuelidate": "0.7.6",
12
+ "vuelidate": "0.7.7",
13
13
  "lodash.template": "4.5.0",
14
14
  "google-libphonenumber": "3.2.21",
15
15
  "moment": "2.29.1"
@@ -23,10 +23,10 @@
23
23
  "cz-conventional-changelog": "3.3.0",
24
24
  "mocha": "9.1.3",
25
25
  "nyc": "15.1.0",
26
- "semantic-release": "18.0.0",
26
+ "semantic-release": "18.0.1",
27
27
  "standard": "16.0.4",
28
- "@semantic-release/changelog": "6.0.0",
29
- "@semantic-release/git": "10.0.0"
28
+ "@semantic-release/changelog": "6.0.1",
29
+ "@semantic-release/git": "10.0.1"
30
30
  },
31
31
  "scripts": {
32
32
  "lint": "standard",
package/test/test.js CHANGED
@@ -76,41 +76,29 @@ describe('Test the vuelidate converter', function () {
76
76
  expect(vuelidate.min3DaysAgo.minimumDate).to.be.a('function')
77
77
  })
78
78
 
79
- it('test the validation function for minimum date', () => {
80
- const fn = vuelidate.min3DaysAgo.minimumDate
81
-
82
- const oneWeekAgo = moment().subtract(7, 'day')
83
- const today = moment()
84
- const tomorrow = moment().add(1, 'day')
85
- const threeDaysAgo = moment().subtract(3, 'days')
86
-
87
- const oneWeekAgoResult = fn(oneWeekAgo)
88
- expect(oneWeekAgoResult).to.eql(false)
89
-
90
- const threeDaysAgoResult = fn(threeDaysAgo)
91
- expect(threeDaysAgoResult).to.eql(true)
92
-
93
- const todayResult = fn(today)
94
- expect(todayResult).to.eql(true)
95
-
96
- const tomorrowResult = fn(tomorrow)
97
- expect(tomorrowResult).to.eql(true)
79
+ const dates = [
80
+ ['1 year ago', moment().subtract(1, 'year'), false, true],
81
+ ['7 days ago', moment().subtract(7, 'day'), false, true],
82
+ ['4 days ago', moment().subtract(4, 'day'), false, true],
83
+ ['3 days ago', moment().subtract(3, 'day'), true, true],
84
+ ['yesterday', moment().subtract(1, 'day'), true, true],
85
+ ['today', moment(), true, true],
86
+ ['tomorrow', moment().add(1, 'day'), true, false],
87
+ ['3 days ahead', moment().add(3, 'day'), true, false],
88
+ ['4 days ahead', moment().add(4, 'day'), true, false],
89
+ ['7 days ahead', moment().add(7, 'day'), true, false],
90
+ ['1 year ahead', moment().add(1, 'year'), true, false]
91
+ ]
92
+
93
+ describe('Test the validation function for minimum date', () => {
94
+ for (const [label, date, minResult] of dates) {
95
+ it(`${label}, should${minResult ? '' : ' not'} be after 3 days ago`, () => expect(vuelidate.min3DaysAgo.minimumDate(date)).to.eql(minResult))
96
+ }
98
97
  })
99
98
 
100
- it('test the validation function for maximum date', () => {
101
- const fn = vuelidate.dateOfBirth.maximumDate
102
-
103
- const yesterday = moment().subtract(1, 'day')
104
- const today = moment()
105
- const tomorrow = moment().add(1, 'day')
106
-
107
- const yesterdayResult = fn(yesterday)
108
- expect(yesterdayResult).to.eql(true)
109
-
110
- const todayResult = fn(today)
111
- expect(todayResult).to.eql(true)
112
-
113
- const tomorrowResult = fn(tomorrow)
114
- expect(tomorrowResult).to.eql(false)
99
+ describe('Test the validation function for maximum date', () => {
100
+ for (const [label, date, , maxResult] of dates) {
101
+ it(`${label}, should${maxResult ? '' : ' not'} be before today`, () => expect(vuelidate.dateOfBirth.maximumDate(date)).to.eql(maxResult))
102
+ }
115
103
  })
116
104
  })