question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests: Refactor test/unit/lib/plugins/aws/package/compile/events/stream.test.js

See original GitHub issue

Most 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:

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:open
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
medikoocommented, Jan 14, 2022

@olgashi done, Thank you!

0reactions
BillConley01commented, Apr 11, 2022

Great, I will work on it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

3 Test Driven Development & Refactoring - YouTube
In this video, I start a new mini-series on testing basics with JavaScript & Jest. In this series, we'll cover the skills needed...
Read more >
Red, Green, Refactor | Codecademy
Red, Green, Refactor ... Test-driven development (TDD) is an approach to software development where you write tests first, then use those tests to...
Read more >
Refactoring towards testable JavaScript, part 1 - The If Works
Refactoring towards testable JavaScript, part 1. This article is one in a 3-part series. The full series is: Part 1: testing JavaScript ......
Read more >
Test-Driven Development Tutorial - freeCodeCamp
Refactor your program (if necessary). Continue the cycle until the calculator matches your vision. Let's now see a JavaScript example of a TDD ......
Read more >
Week 7 - Unit Tests and TDD · GitBook
JS Core III - 1 · Tracing Code · Testing · Unit Testing · Unit Testing Frameworks - JEST · Test-driven Development ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found