How to write Integration Tests for Serverless AWS Endpoints - API Gateway and Lambda Guide with Jest

preview_player
Показать описание
Event generator code:

Completed Code
Рекомендации по теме
Комментарии
Автор

Perfect content! I want to leave a comment for supporting chanel!

konstantin
Автор

Thanks for the content! Just want to support the channel that is why I left the comment :) Good luck with further videos!

(probably i just missed that) It would be nice to mentioned at about approach how to run tests locally and on CI using DynamoDB copy, it would help for less experienced in serverless guys

yaroslavdraha
Автор

Hi Sam Having problems with this one - jest command wont take the env variables - every time I try to add the tableName= (at 20:23 in the tutorial) and get :
"not recognized as the name of a cmdlet, function, script file, or operable program...."
I have googled / stack overflowed this but can't find an answer that works for me.
- any ideas whats wrong? Thanks in advance again

PeteWhelan
Автор

Hi Sam, how can I support your channel? Info here is so pricesless just want to show some appreciation.

privymassage
Автор

@8:00 Why not define a default response object, then use the object spread method which has been supported since Node 8.6? ie: eventGenerator(options) { const default = {default event stuff}; return { ...default, ...options }; } -- this is a lot more flexible than the method you use, and requires no editing if later on you need to redefine a variable that you have blank in the default?

frozennb
Автор

Awesome stuff,
Just want to know how can mock context parameter of handler function from unit test, can we pass something like contextGenerator()?

vigneshdev
Автор

Great explanation!

Do u mind sharing vscode extensions names especially the one which checks the code with (x) and (✓) marks and the one that highlights code blocks with different colors?

ahmadnabil
Автор

what if the lambda is not exposed to API Gateway nor AppSync? can we still write some integration test against it? It's only called by some other lambda(s) that were exposed via AppSync.

wendyliew
Автор

Sam do you have a video of writing the tests with java? what will be the difference if I want to write the tests in java?

mojgandadashi
Автор

Hi, when you save data into DynamoDB, then you have to delete it? Or it's just a mock of Dynamo that you are using on this example?

EstebanHelgueroCardiff
Автор

Hello Sam, does these integration tests leverage emulated API gateway?
I want to test the endpoint using it's route (e.g.: GET - /api/players) to test API key authentication. Is this possible?

madhavareddy
Автор

Why not test actual calls to the api gateway instead of testing the handler function?

nemesaenz
Автор

I'm having issues running integration tests after I decided to create multiple environments for my deploys, not sure if that's related but when I run the test using "tableName=user jest" it says "ResourceNotFoundException: Cannot do operations on a non-existent table" when I try to write into Dynamo table.
Any suggestion?

cristianecheverria
Автор

Can you please create one vblog for cognito service to integrate jest test case. It's mean sign in, sign up, post confirmation.

jc
Автор

ran the command "sls offline start --location ." . showing errors

gajendrakumarmangaraja
join shbcf.ru