Very Disoriented - Anonymous Message Board

UPDATE: Welp, it never fails; after hours of failure, it looks like I finally figured it out about 30 seconds after having posted here.

Hey Campers,

I thought I was close to finishing this project but I’ve hit a major roadblock; the routing and MongoDB portions were fairly straightforward, and I’m happy to say that I got all the POST/GET/DELETE/PUT tests to pass within a work day (about 10,5 hours of coding) :smile: :smile:

The functional testing, however, is killing me (even though it was a breeze in the previous project). I got the chai tests for GET and POST to pass, but I cannot figure out what to do with the DELETE and PUT tests because those trigger an alert pop-up, which I don’t know how to “detect” in order to test for its content.

Since we’re talkin about an alert pop-up, I figured I had to test using a headless browser and went back to the Zombie lessons. I’m not aware of Chai being good for working with alerts. Anyway, I have spent HOURS trying with zombie and I’ve gotten nowhere. I’ve gotten to the point in which I’m not learning anything useful anymore, just wasting way too much time. And I don’t even know if using zombie.js is the right approach!

Can someone please point me in the right direction? Is Zombie the correct way to go? Is there any way to evaluate alert popups with Chai? I really can’t afford to continue putting in more hours on an approach I’m not even sure is the right one (but out of what the fCC course has covered, Zombie seemed to be the correct choice)

I know it’s possible to send out alerts and check for them with ChaiJS. Those elements have a role of “alert”. But I don’t think those are the kind of tests you need to write.

  • Deleting a thread with the incorrect password: DELETE request to /api/threads/{board} with an invalid delete_password
  • Deleting a thread with the correct password: DELETE request to /api/threads/{board} with a valid delete_password
  • Deleting a reply with the incorrect password: DELETE request to /api/replies/{board} with an invalid delete_password
  • Deleting a reply with the correct password: DELETE request to /api/replies/{board} with a valid delete_password

I would double check the status returned by the requests and make sure they were successful. And make sure the right elements were deleted.