@@ -543,4 +543,73 @@ describe(`API Tests`, function () {
543
543
} ) ;
544
544
} ) ;
545
545
} ) ;
546
+ /*
547
+ describe(`Tests on "/messages"`, function () {
548
+ describe(`Correct Input Tests`, function () {
549
+ it(`[200 | Admin | GET "/messages" | ]`, (done) => {
550
+ chai.request(app)
551
+ .get("/messages")
552
+ .set("Authorization", `Bearer ${adminToken}`)
553
+ .end((err, res) => {
554
+ chai.expect(res.status).to.equal(200);
555
+ chai.expect(res.body).to.have.property("success").that.equals(false);
556
+ chai.expect(res.body).to.have.property("message").that.is.oneOf(["No messages found.", "Messages retrieved."]);
557
+ chai.expect(res.body).to.have.property("messages").that.is.a("object");
558
+ done();
559
+ });
560
+ });
561
+ it(`[200 | NoAuth | POST "/messages" | ]`, (done) => {
562
+ chai.request(app)
563
+ .post("/messages")
564
+ .type("json")
565
+ .send({
566
+ name: "Name 1",
567
+ email: "name1@mail .com",
568
+ message: "Test Message 1",
569
+ })
570
+ .end((err, res) => {
571
+ chai.expect(res.status).to.equal(200);
572
+ chai.expect(res.body).to.have.property("success").that.equals(false);
573
+ chai.expect(res.body).to.have.property("message").that.is.oneOf(["No messages found.", "Messages retrieved."]);
574
+ chai.expect(res.body).to.have.property("messages").that.is.a("object");
575
+ done();
576
+ });
577
+ });
578
+ it(`[200 | Auth | POST "/messages" | ]`, (done) => {
579
+ chai.request(app)
580
+ .post("/messages")
581
+ .type("json")
582
+ .send({
583
+ name: "Name 2",
584
+ email: "name2@mail .com",
585
+ message: "Test Message 2",
586
+ })
587
+ .set("Authorization", `Bearer ${userToken}`)
588
+ .end((err, res) => {
589
+ chai.expect(res.status).to.equal(200);
590
+ chai.expect(res.body).to.have.property("success").that.equals(false);
591
+ chai.expect(res.body).to.have.property("message").that.is.oneOf(["No messages found.", "Messages retrieved."]);
592
+ chai.expect(res.body).to.have.property("messages").that.is.a("object");
593
+ done();
594
+ });
595
+ });
596
+ });
597
+ describe(`Authorization Tests`, function () {
598
+ it(`[403 | NoAuth | GET "/messages" | ]`, (done) => {});
599
+ it(`[403 | Auth | GET "/messages" | ]`, (done) => {});
600
+ });
601
+ describe(`Missing Input Tests`, function () {});
602
+ describe(`Invalid Input Tests`, function () {});
603
+ describe(`Failure Tests`, function () {});
604
+ });
605
+ */
606
+ /*
607
+ describe(`Tests on "/blogs"`, function () {
608
+ describe(`Correct Input Tests`, function () {});
609
+ describe(`Authorization Tests`, function () {});
610
+ describe(`Missing Input Tests`, function () {});
611
+ describe(`Invalid Input Tests`, function () {});
612
+ describe(`Failure Tests`, function () {});
613
+ });
614
+ */
546
615
} ) ;
0 commit comments