constregisterUserRequestDto=require('../registerUserRequestDto')describe('Test Suite: registerUserRequestDto', () => {// tests go here...})
I personally always like to write at least 1 test for both a passing and failing scenario.
Of course you can always write more tests to cover more additional scenarios and edge cases . For our purposes, we'll just be sticking to writing 1 passing test and 1 failing test.
The Passing Test
The first one is simple, let's add in all the required fields in registerUserRequestDto and expect what we want out of it.
The next test case is what happens if we don't pass the correct inputs into the registerUserRequestDto function. We would expect an error, and not just any error, but an ApiException error being thrown.