JEST Unit testing of a function

Job ID: 30701834

Budget: €30 – €250 EUR

Hello,

For a project need a developer which has knowledge of JEST Unit testing to help me with the test of a function as I never used the JEST technology.

The function in question is this:
https://pastebin.com/FNHRMRwT

Related to this function we have to mock the results of the mutations as I understood
https://pastebin.com/64yM0iVG

The function should be enough to be replicated on the local of the developer as no DB is involved and the data results can be mocked.

The data sent to this function as input is as follow:
https://pastebin.com/1RPSA0dk

The only part changes of the structure is the top 2 keys email or phone we always have one of those but never both.

What I need is to have it test with JEST and I need the results as:

- Positive
-> means the create token is called and compared with what result is expected from the mutation mocked
-> the messages is sent for the phone/email

- Negative are the errors working like we don't have any input should show the log.error

Due the nature of the project itself I can only share the files above if it is require to see the files originally we may do that via teamViewer or AnyDesk connection

Thank you for your understanding.
Related categories: JavaScript Engineering Software Testing Node.js GraphQL