Skip to content

Commit

Permalink
docs(vest): isTested
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Dec 1, 2023
1 parent 3ad7193 commit 4c34429
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions website/docs/api_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ keywords:
getErrorsByGroup,
getWarningsByGroup,
isPending,
isTested,
isValid,
isValidByGroup,
done,
Expand Down Expand Up @@ -101,6 +102,7 @@ After running your suite, the results object is returned. It has the following f
- [getErrorsByGroup](./writing_your_suite/accessing_the_result.md#geterrorsbygroup-and-getwarningsbygroup) - Returns an object with errors in the provided group.
- [getWarningsByGroup](./writing_your_suite/accessing_the_result.md#geterrorsbygroup-and-getwarningsbygroup) - Returns an object with warnings in the provided group.
- [isPending](./writing_your_suite/accessing_the_result.md#ispending) - Returns true if the suite has pending async tests.
- [isTested](./writing_your_suite/accessing_the_result.md#istested) - Returns true if the provided field has been tested.
- [isValid](./writing_your_suite/accessing_the_result.md#isvalid) - Returns true if the suite or the provided field is valid.
- [isValidByGroup](./writing_your_suite/accessing_the_result.md#isvalidbygroup) - Returns true if a certain group or a field in a group is valid or not.
- [done](./writing_your_suite/accessing_the_result.md#done) - Accepts a callback that will run when the suite is done running.
Expand Down
18 changes: 17 additions & 1 deletion website/docs/writing_your_suite/accessing_the_result.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ The `getError()` function allows you to retrieve the first error message of a gi

If a field name is provided, it returns the first error message for that field, or `undefined` if there were no errors for that field. If no field name is provided, it returns the first error object in the `errors` array, or `undefined` if there were no errors.

#### Example:
#### Example

```js
const error = result.getError(); // get first error object
Expand Down Expand Up @@ -391,3 +391,19 @@ suite.isPending('username');

suite.get().isPending('username');
```

## isTested

Returns whether a given field has been tested or not. A field is considered tested if it has at least one test that ran.

Returns `true` if the field is tested, `false` otherwise.

```js
const suite = vest.create(() => {
test("username", "Username is required", () => {
enforce(username).isNotBlank();
});
});

suite.isTested("username"); // true if username has been tested
```

2 comments on commit 4c34429

@vercel
Copy link

@vercel vercel bot commented on 4c34429 Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vest – ./website

vest-git-latest-ealush.vercel.app
vest.vercel.app
vest-ealush.vercel.app
vestjs.dev
www.vestjs.dev

@vercel
Copy link

@vercel vercel bot commented on 4c34429 Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vest-next – ./website

vest-next-ealush.vercel.app
vest-website.vercel.app
vest-next-git-latest-ealush.vercel.app
vest-next.vercel.app

Please sign in to comment.