Closed Harsh-br0 closed 1 year ago
Hi, I will test this shortly.
Hi @benjamin-tang-pusher , is there any problem in this PR? I didn't get any updates regarding this pull since 10 days
Hi, sorry for the late response. When I run the the tests ini your branch with npm run test
I get the following two failures:
FAIL src/do-request.test.js
● Handles URL with params
TypeError: Cannot read properties of undefined (reading '0')
FAIL src/push-notifications.test.js
● Test suite failed to run
SyntaxError: /Users/benjamintang/Documents/development/node/harsh-bro/src/push-notifications.js: Support for the experimental syntax 'optionalChaining' isn't currently enabled (262:14):
Could you check src/do-request.test.js and check if your changes affected this test?
For optionalChaining
I get Add @babel/plugin-proposal-optional-chaining (https://git.io/vb4Sk) to the 'plugins' section of your Babel config to enable transformation.
Did you have to do this too?
Hi @benjamin-tang-pusher , so I've fixed all tests and that OptionalChaining
issue. The problems were the following -
Somehow the jest returns undefined
on lastCall
in .mock
property which isn't the expected behaviour as per docs.
I forgot to check version compatibility on package and used a ES2020
feature (OptionalChaining
) that is obviously unsupported on ES2015
based package. Apologies for it
Thank you!
Description
As per docs,
getDeviceInterests
must acceptlimit
andcursor
args to be passed with query parameters in the API. Currently, API returns 100 results since limit implies with 100 as default value in API, so i first redesigned the endpoint caller function here to accept query params as object inparams
arg and reworked thegetDeviceInterests
method here to return value as Object that includescursor
field from API response and addlimit
andcursor
to method parameters. Also I've added a test forparams
arg in do-request.test.jsNotable Changes
getDeviceInterests
now returns Object instead of an Array.doRequest
function can have params arg in Object to represent query params in URLpotentially fixes #115