ifme icon indicating copy to clipboard operation
ifme copied to clipboard

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

Open julianguyen opened this issue 2 years ago • 9 comments

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 avatar Oct 02 '22 04:10 julianguyen

I would like to give this a try @julianguyen

akk312000 avatar Oct 02 '22 04:10 akk312000

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

julianguyen avatar Oct 02 '22 04:10 julianguyen

@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

akk312000 avatar Oct 02 '22 05:10 akk312000

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

julianguyen avatar Oct 02 '22 05:10 julianguyen

@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 avatar Oct 16 '22 07:10 saminarp

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?

saminarp avatar Oct 17 '22 08:10 saminarp

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

lucas-codes-stuff avatar Feb 18 '24 20:02 lucas-codes-stuff

@lucas-codes-stuff that is correct!

julianguyen avatar Feb 19 '24 17:02 julianguyen