Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Create tests for `vessel-charging/messages/VesselStatusMessageParams` using jest. #30
This issue is tagged first-timers-only. It is only for people who have never contributed to open source before, and are looking for an easy way take their first steps.
Consider this your chance to dip your toe into the world of open-source, and get some bragging rights for writing code that makes drones fly, lets cars find charging stations, helps people and goods get from place to place, and more.
Find more first-timers-only issues from DAV Foundation here.
Thank you for your help
What is this project?
DAV (Decentralized Autonomous Vehicles) is a new foundation working to build an open-source infrastructure for autonomous vehicles (cars, drones, trucks, robots, and all the service providers around them) to communicate and transact with each other over blockchain.
As an organization that believes in building a large community of open-source contributors, we often create issues like this one to help people take their first few steps into the world of open source.
This SDK enabled integrating any client side JS and NodeJS code with the DAV Network.
How you can help
Create tests for
You need to create tests to check that the
Please use the test file for class
NOTE: Some names are changed between protocol string representation of instance properties:
Contributing to dav-js
Asking for help
We appreciate your effort in taking the time to work on this issue and help out the open source community and the foundation. If you need any help, feel free to ask below or in our gitter channel. We are always happy to help
Hello team! My name is Eric. I am an experienced developer but have never contributed to open source. I would like to help if possible.
I reviewed the sample code (https://github.com/DAVFoundation/dav-js/blob/master/src/vessel-charging/NeedParams.test.ts).
The question I have is this:
Is there a specific reason for using Jest Matcher
Typically, toEqual is too coupled with implementation for testing objects and makes for a brittle test. If we add n+1 properties to object1 class, we need to update the test. I feel that this will cause slowdowns in development because the assertion is too narrow, causing the test to be too brittle.
The idea I had was to use
Thank you @ericcgu
That's a very good observation. I had to take some time to consider it, but I think I prefer the current implementation using
The test for the serializer makes sure that a certain input always gives a certain predictable output. And both the expected input and output are present in the test code. If in the future we change how the serialization works (e.g., by adding not just
Yes, it's a change that might happen in the parent NeedParams and then affect the vessel-charging NeedParams test, and so could be argued to be too coupled. But I like how the expected outcome of the function is explicitly stated here. Makes the test read like documentation.
Anyway, as I already said, that is an excellent observation. We would be honored to have your expertise and help you get started on your path to more involvement with open source. Open source has had a tremendous influence on my career (success and enjoyment)... it's a path worth taking.