Skip to content

Commit 1f449cd

Browse files
committed
guidelines: pest: standardise
1 parent d8cc91b commit 1f449cd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

.ai/pest/core.blade.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
## Testing
2-
If you need to verify a feature is working, write or update a Unit / Feature test.
2+
- If you need to verify a feature is working, write or update a Unit / Feature test.
33

44
# Pest Tests
55
- All tests must be written using Pest.
66
- You must not remove any tests or test files from the tests directory without approval. These are not temporary or helper files, these are core to the application.
77
- Tests should test all of the the unhappy paths, happy paths, and weird paths.
88
- Tests live in the `tests/Feature` and `tests/Unit` directories.
99
- Pest tests look and behave like this:
10-
<code-snippet lang="php">
10+
<code-snippet name="Basic example Pest test" lang="php">
1111
it('is true', function () {
1212
expect(true)->toBeTrue();
1313
});
@@ -22,7 +22,7 @@
2222

2323
## Pest Assertions
2424
- When asserting status codes on a response, use the specific method like `assertForbidden`, `assertNotFound` etc, instead of using `assertStatus(403)` or similar, e.g.:
25-
<code-snippet>
25+
<code-snippet name="Pest asserting postJson response" lang="php">
2626
it('returns all', function () {
2727
$response = $this->postJson('/api/docs', []);
2828

@@ -32,13 +32,13 @@
3232

3333
## Mocking
3434
- Mocking can be very helpful.
35-
- When mocking, you can use the pest function `Pest\Laravel\mock`, and always import it before usage with `use function Pest\Laravel\mock;` or you can use `$this->mock()`.
35+
- When mocking, you can use the pest function `Pest\Laravel\mock`, and always import it before usage with `use function Pest\Laravel\mock;`. Alternatively you can use `$this->mock()` if existing tests do.
3636
- You can also create partial mocks using the same import or self method.
3737

3838
## Datasets
3939
- Use datasets in Pest to simplify tests which have a lot of duplicated data. This often the case when testing validation rules, so often go with the solution of using datasets when writing tests for validation rules.
4040

41-
<code-snippet lang="php" package="pest">
41+
<code-snippet name="Pest dataset example" lang="php">
4242
it('has emails', function (string $email) {
4343
expect($email)->not->toBeEmpty();
4444
})->with([

0 commit comments

Comments
 (0)