Tests: Refactor test/unit/lib/plugins/aws/package/compile/events/stream.test.js
See original GitHub issueMost of the tests that currently cover core functionalities depend heavily on (and sometimes test) internal implementation characteristics. While they should be testing whether the given implementation produces desired outcome (treating its implementation more as a black box).
Current state of things is problematic for eventual internal improvements and refactors which occasionally we want to introduce, as in most of such cases proposed improvements need to be accompanied with counterproductive numerous updates to tests which are covering otherwise not altered functionalities .
_At some point, we’ve introduced a new (black box based) way of testing the internals. It’s through runServerless
utility, which allows us to create a natural (as in real-world) serverless
instance, and inspect the produced outcome for chosen command. More details here: https://github.com/serverless/serverless/tree/master/test#unit-tests_
This is issue is about refactoring test/unit/lib/plugins/aws/package/compile/events/stream.test.js to runServerless
based variant.
It’s needed, so we cleanly move forward with https://github.com/serverless/serverless/issues/8396
To make refactor relatively easy:
- Spec for new tests is fully defined and is already committed in. It’s in the scope of this describe block: https://github.com/serverless/serverless/blob/654c50792ace1ee675fe5d6843faaafe1179bc25/test/unit/lib/plugins/aws/package/compile/events/stream.test.js#L1446-L1914
- Each test slot indicates which test it is about to replace
- It is indicated where (and how many) exactly
runServerless
runs are expected to happen, against which fixture and command they should be based - Necessary hints are provided
For every refactored test, the old test should be removed
Refactor can be submitted with one PR, but partial refactors are also very welcome
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
@olgashi done, Thank you!
Great, I will work on it.