Tell us what’s happening:
I pass all the tests but i cannot move on to the next stage
###Your project link(s)
githubLink: GitHub - lukwagoasuman/boilerplate-project-messageboard: A boilerplate for a freeCodeCamp project.
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Challenge Information:
Information Security Projects - Anonymous Message Board
The code in your repo is not passing the tests for me.
-
You have scoped variables in messageBoard.js
-
You are deleting the replies and thread in a beforeEach
in the tests.
You should not see “All 10 functional tests are complete and passing” in the top log out if you are passing the tests.
// running tests
All 10 functional tests are complete and passing.
// tests completed
You should be seeing an X by the last test and not a checkmark. If you pass the tests it would be a checkmark.
When I fix the two mentioned issues, I pass all the tests.
1 Like
It’s a bit inconsistent but thank you so much …
You mean the top log is inconsistent?
If so, I kind of agree the last test is. But it is because the assert message is asserting a positive and not a negative, and then have an X or checkmark as the indicator of if the message is a pass or fail. The asserts are put in the top log as is. So they only appear if a test is failing.
I can see how that can be misinterpreted as it passing the tests. But if you look at the individual tests, it should be less confusing.
1 Like
Thanks alot, i am now working on it with the provided solution, so sorry i cannot close this thread now until i fix it …msg board == countless sleepless nights abit new to JS though …more help is welcome !
What about the issues I mentioned is not clear?
-
The thread
and reply
variables used inside messageBoard.js
are redeclared inside the scope of an if block. You should reassign the variables, not redeclare them.
-
If you delete the Thread
and Reply
after each test, your tests that rely on them existing will fail. E.g. One test makes a POST to create a thread and then the next test (e.g. a GET) relies on that thread to exist. Which it won’t if you delete them before each test.
suite("Functional Tests", function () {
beforeEach(async function () {
await Thread.deleteMany({});
await Reply.deleteMany({});
});
1 Like
i love you @lasjorg thank you for the help, actually it had failed countless times so i thought this one would too that’s why i decided to add the beforeEach to try to delete conflicting tests, like i said it was countless failures but i got it …thank you again!
1 Like