Skip to content

Commit

Permalink
readme draft
Browse files Browse the repository at this point in the history
  • Loading branch information
oatkiller committed Aug 10, 2020
1 parent 4c13ab7 commit d8800d9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions x-pack/plugins/security_solution/public/resolver/mocks/README.md
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

0 comments on commit d8800d9

Please sign in to comment.