-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
oatkiller
committed
Aug 10, 2020
1 parent
4c13ab7
commit d8800d9
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/security_solution/public/resolver/mocks/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
* reuse in mocks is good | ||
- because if all mocks need to change, you change them easier and have all the tests run against the new version? | ||
- if theres a bug in the way we make a mock, we want to fix it everywhere | ||
- the mock mocks something we have in production, so if the iterface or design that changes, all mocks need to change | ||
* mocks should have deterministic, concrete, unique, interesting behavior: | ||
- a resolver tree with no ancestors | ||
- 2 children | ||
- the origin has 2 related events | ||
- 'when analyzing a tree with 2 children' | ||
- 'when analyzing a tree with no ancestors' | ||
|
||
* internally to the 'mocks' module | ||
- feel free to use helpers, composition, configuration, parameters, etc | ||
|
||
* mocks exported should have little or no configuration, a very specific name, | ||
|
||
* mock metadata | ||
- when a mock uses interesting data like entity_ids, process names, times, PIDs, etc, that a test will check, then export that stuff in an object from the module that defines the mock | ||
- that way it can be used in the `describe` and `it` blocks that give the test a name | ||
|
||
* prefer to mock DataAccessLayer and ResolverTree | ||
- also mock the payloads of any action |