Darko Milosevic
Jan 28, 2020 ⋅ 9 min read

Testing Node serverless applications — AWS Lambda functions

Darko Milosevic I'm a JavaScript developer who loves exploring, coding, and blogging — but only because it's fun.

Recent posts:

Automate Repetitive Tasks With The Pinion Code Generator

Automate repetitive tasks with the Pinion code generator

Discover how the Pinion code generator automates repetitive tasks and boosts productivity compared to tools like Yeoman, Plop, and Hygen.

Joseph Mawa
May 21, 2024 ⋅ 7 min read
Exploring Hurl An Alternative To Postman

Exploring Hurl, a command line alternative to Postman

Hurl is an excellent Postman alternative that improves the DX of working with APIs through the command line.

Nwani Victory
May 20, 2024 ⋅ 8 min read
How To Integrate WunderGraph With Your Frontend Application

How to integrate WunderGraph with your frontend application

Unify and simplify APIs using WunderGraph to integrate REST, GraphQL, and databases in a single endpoint.

Boemo Mmopelwa
May 17, 2024 ⋅ 5 min read
Understanding The Latest Webkit Features In Safari 17.4

Understanding the latest Webkit features in Safari 17.4

The Safari 17.4 update brought in many modern features and bug fixes. Explore the major development-specific updates you should be aware of.

Rahul Chhodde
May 16, 2024 ⋅ 10 min read
View all posts

2 Replies to "Testing Node serverless applications — AWS Lambda functions"

  1. I’m really happy I found your post, as testing in serverless is not a much talked about topic! I’m not sure if you’re following it on purpose, but the pattern you’re proposing is really close to Clean Architecture. One thing that I have done recently to extremely simply writing tests is to abstract out the “interfaces” such as s3, sqs, etc from the business logic. I wrote a wrapper for each interface that presents an api to the business logic, and use an application context factory to inject the interface dependencies. That way, you can test the wrapper, and your business logic – but you can completely fake your interfaces with a test application context. No need to instantiate AWS() in your tests that way.

  2. Thanks Chris!
    Yes, this pattern is quite similar to the Clean Architecture, with the accent on decoupling components (I/O etc) from the core logic.

Leave a Reply