Namit2111 / bible-verse-finder

https://bible-verse-finder.vercel.app
GNU General Public License v3.0
23 stars 31 forks source link

Write tests for the app #31

Open Namit2111 opened 1 month ago

Namit2111 commented 1 month ago

We need tests for the whole app including backend and frontend that we can run on PR before merging them.

rajatkriplani commented 1 month ago

Please refer to my fork before going through this comment. I'm getting some errors while running the test. And the error occurs during the import of app in your test_app.py and originates from the NLTK library when trying to read the 'bible-kjv.txt' file from the Gutenberg corpus. Here's the relevant part of the traceback (from terminal):

backend/utils/utils.py:15: in <module>
    bible = gutenberg.raw('bible-kjv.txt')
myenv/lib/python3.12/site-packages/nltk/corpus/reader/api.py:219: in raw
    contents.append(fp.read())
myenv/lib/python3.12/site-packages/nltk/data.py:1139: in read
    chars = self._read(size)
myenv/lib/python3.12/site-packages/nltk/data.py:1425: in _read
    bytes = self.bytebuffer + new_bytes
E   TypeError: can't concat str to bytes

AND

[nltk_data] Downloading package gutenberg to /home/rajat/nltk_data...
[nltk_data]   Unzipping corpora/gutenberg.zip.
[nltk_data] [Errno 2] No such file or directory:
[nltk_data]     '/home/rajat/nltk_data/corpora/gutenberg.zip'

fixes as follows:

JustinhSE commented 1 month ago

@Namit2111

Namit2111 commented 1 month ago

hi @rajatkriplani which fork are you referring to can you please link it ?

rajatkriplani commented 1 month ago

hi @rajatkriplani which fork are you referring to can you please link it ?

You can check the test_app.py here.

Namit2111 commented 1 month ago

hi @rajatkriplani when are you available? ping me in discord

d-beloved commented 1 day ago

@JustinhSE @Namit2111 I think we should break this issue into two, for writing tests for the Frontend and another for Backend tests, then we can consolidate the check via a CI workflow