Skip to content

Commit

Permalink
🤯 Updating: [vest]: (3.2.0)
Browse files Browse the repository at this point in the history
dcd8ad2  feat(vest): add conditional to skip (ealush)
e3b42c6  minor(vest): account for async tests in isValid function (ealush)
339fe45  patch(Vest): shave off a few bytes (ealush)
60099b3  feat(vest): add support for optional tests and isValid (ealush#612) (Evyatar)
73f2e35  patch: use fieldCallbacks as an object (ealush)
94dd7a5  patch: simplify produce function generation (ealush)
09b2aa4  feat: vest.skipWhen for conditional test exclusion (ealush#611) (Evyatar)
d53d56d  patch(vest): prevent skipped tests from persisting after override (ealush)
c0180d1  patch(vest): upgrade context package (ealush)
5791fef  patch(vest): use vast state library (ealush)
a5aa3f1  patch(vest): make state independent of context (ealush#609) (Evyatar)
32b1d05  feat(vest): add state subscription (ealush#606) (Ronen Elster)
0bb9347  minor(vest): add skipped tests to result as well (ealush#600) (Evyatar)
72b3e40  patch: remove package-lock.json (ealush)
74cb2d6  patch(vest): add remove type, fix typo (ealush#578) (Yakko Majuri)
  • Loading branch information
ealush authored and shani-arnon committed Aug 4, 2022
1 parent 1954ac7 commit dde3e90
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## vest: [3.2.0] - 2021-05-14

### Added
- dcd8ad2 feat: add conditional to skip (ealush)
- e3b42c6 minor: account for async tests in isValid function (ealush)
- 60099b3 feat: add support for optional tests and "isValid" (#612) (Evyatar)
- 09b2aa4 feat: vest.skipWhen for conditional test exclusion (#611) (Evyatar)
- 32b1d05 feat: add state subscription (#606) (Ronen Elster)
- 0bb9347 minor: add skipped tests to result as well (#600) (Evyatar)

### Fixed and improved
- 339fe45 patch: shave off a few bytes (ealush)
- 73f2e35 patch: use fieldCallbacks as an object (ealush)
- 94dd7a5 patch: simplify produce function generation (ealush)
- d53d56d patch: prevent skipped tests from persisting after override (ealush)
- c0180d1 patch: upgrade context package (ealush)
- 5791fef patch: use vast state library (ealush)
- a5aa3f1 patch: make state independent of context (#609) (Evyatar)
- 72b3e40 patch: remove package-lock.json (ealush)
- 74cb2d6 patch: add "remove" type, fix typo (#578) (Yakko Majuri)

## vest: [3.1.2] - 2021-01-30

### Fixed and improved
Expand Down
7 changes: 7 additions & 0 deletions packages/vest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [Example 4](https://stackblitz.com/edit/vest-react-registration?file=validate.js)
- [Example 5 (Password validator)](https://codesandbox.io/s/password-validator-example-6puvy?file=/src/validate.js)
- [VueJS Example](https://codesandbox.io/s/vest-vue-example-1j6r8?file=/src/validations.js)
- [Svelte Example](https://codesandbox.io/s/vestdocssvelteexample-k87t7?file=/validate.js)

## Tutorials

Expand Down Expand Up @@ -93,6 +94,10 @@ export default vest.create('user_form', (data = {}, currentField) => {
});
}

test('email', 'Email Address is not valid', () => {
enforce(data.email).isEmail();
});

test('tos', () => {
enforce(data.tos).isTruthy();
});
Expand All @@ -106,3 +111,5 @@ export default vest.create('user_form', (data = {}, currentField) => {
- 🧱 Your validations are structured, making it very simple to read and write. All validation files look the same.
- 🖇 Your validation logic is separate from your feature logic, preventing the spaghetti code that's usually involved with writing validations.
- 🧩 Validation logic is easy to share and reuse across features.

**Vest is an evolution of [Passable](https://github.com/fiverr/passable) by Fiverr.**
24 changes: 14 additions & 10 deletions packages/vest/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [Example 4](https://stackblitz.com/edit/vest-react-registration?file=validate.js)
- [Example 5 (Password validator)](https://codesandbox.io/s/password-validator-example-6puvy?file=/src/validate.js)
- [VueJS Example](https://codesandbox.io/s/vest-vue-example-1j6r8?file=/src/validations.js)
- [Svelte Example](https://codesandbox.io/s/vestdocssvelteexample-k87t7?file=/validate.js)

## Tutorials

Expand Down Expand Up @@ -61,10 +62,10 @@ Vest tries to remediate this by separating validation logic from feature logic s
## Example code ([Run in sandbox](https://codesandbox.io/s/vest-react-tutorial-finished-ztt8t?file=/src/validate.js))

```js
import vest, { test, only, skip } from 'vest';
import vest, { test } from 'vest';

export default vest.create('user_form', (data = {}, currentField) => {
only(currentField);
vest.only(currentField);

test('username', 'Username is required', () => {
enforce(data.username).isNotEmpty();
Expand All @@ -87,14 +88,15 @@ export default vest.create('user_form', (data = {}, currentField) => {
enforce(data.password).matches(/[0-9]/);
});

skip(
() => !data.password,
() => {
test('confirm_password', 'Passwords do not match', () => {
enforce(data.confirm_password).equals(data.password);
});
}
);
if (data.password) {
test('confirm_password', 'Passwords do not match', () => {
enforce(data.confirm_password).equals(data.password);
});
}

test('email', 'Email Address is not valid', () => {
enforce(data.email).isEmail();
});

test('tos', () => {
enforce(data.tos).isTruthy();
Expand All @@ -109,3 +111,5 @@ export default vest.create('user_form', (data = {}, currentField) => {
- 🧱 Your validations are structured, making it very simple to read and write. All validation files look the same.
- 🖇 Your validation logic is separate from your feature logic, preventing the spaghetti code that's usually involved with writing validations.
- 🧩 Validation logic is easy to share and reuse across features.

**Vest is an evolution of [Passable](https://github.com/fiverr/passable) by Fiverr.**
2 changes: 1 addition & 1 deletion packages/vest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vest",
"version": "3.1.2",
"version": "3.2.0",
"description": "Declarative validations.",
"main": "./vest.js",
"browser": "./vest.js",
Expand Down

0 comments on commit dde3e90

Please sign in to comment.