Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write unit tests for client/app/utils/index.js #2128

Open
julianguyen opened this issue Oct 2, 2022 · 9 comments
Open

Write unit tests for client/app/utils/index.js #2128

julianguyen opened this issue Oct 2, 2022 · 9 comments
Assignees
Labels
hacktoberfest javascript Pull requests that update Javascript code react tests up-for-grabs

Comments

@julianguyen
Copy link
Member

Description

Write unit tests for client/app/utils/index.js

Functions include:

  • randomString
  • setCsrfToken
  • getPusher
  • renderContent

Please assign yourself (via the Assignees dropdown), if you do want to work on this issue. Can't find yourself? You need to join our organization.

Check out our Picking Up Issues guide if you haven't already!

@julianguyen julianguyen added hacktoberfest react tests javascript Pull requests that update Javascript code labels Oct 2, 2022
@akk312000
Copy link

I would like to give this a try @julianguyen

@julianguyen
Copy link
Member Author

That would be great, thank you! Feel free to assign yourself to the issue @akk312000 :)

@akk312000
Copy link

akk312000 commented Oct 2, 2022

@julianguyen I'm not able assign the issue to myself, can you guide me how should I do that? I'm not able to see the "assign yourself" button near Assignees field

@julianguyen
Copy link
Member Author

@akk312000 Ahh looks like you're not added to the project org. I just sent you an invitation and assigned you.

@akk312000 akk312000 removed their assignment Oct 13, 2022
@saminarp saminarp self-assigned this Oct 13, 2022
@saminarp
Copy link
Contributor

@julianguyen I am investigating this and I wanted to ask if I am supposed to create __tests__ folder in utils to write the corresponding tests for index.js. Please let me know :)

@saminarp
Copy link
Contributor

Hello @julianguyen,
I noticed that in package.json jest configurations there's "testRegex": "./app/.*.spec\\.jsx?$" meaning that this regex will only capture the test files which includes spec in the filename. I am writing my tests under the name index.test.js. Do you suggest updating the regexp? Or do the unit test files need to be somewhere else with a different naming convention?

@lucas-codes-stuff
Copy link

@julianguyen What else needs to be done on this issue? Unit tests for setCsrfToken and renderContent?

@julianguyen
Copy link
Member Author

@lucas-codes-stuff that is correct!

@camillof
Copy link
Contributor

Looks like this one is already covered here? 893d433 🤔 ?

https://github.com/ifmeorg/ifme/blob/main/client/app/utils/__tests__/index.spec.jsx

I can write better tests for randomString but otherwise, tests looks good.

cc @julianguyen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest javascript Pull requests that update Javascript code react tests up-for-grabs
Projects
None yet
Development

No branches or pull requests

5 participants