My ham website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.7 KiB

6 years ago
  1. 'use strict'
  2. var app = require('../app')
  3. var chai = require('chai')
  4. var request = require('supertest')
  5. var expect = chai.expect
  6. describe('Integration Tests', function () {
  7. describe('# GET /', function () {
  8. it('should get the homepage', function (done) {
  9. request(app).get('/')
  10. .end(function (err, res) {
  11. expect(res.statusCode).to.equal(200)
  12. done()
  13. })
  14. })
  15. })
  16. describe('# GET /posts', function () {
  17. it('should get the posts page', function (done) {
  18. request(app).get('/posts')
  19. .end(function (err, res) {
  20. expect(res.statusCode).to.equal(200)
  21. done()
  22. })
  23. })
  24. })
  25. describe('# GET /about', function () {
  26. it('should get the about page', function (done) {
  27. request(app).get('/about')
  28. .end(function (err, res) {
  29. expect(res.statusCode).to.equal(200)
  30. done()
  31. })
  32. })
  33. })
  34. describe('# GET /uncopyright', function () {
  35. it('should get the uncopyright page', function (done) {
  36. request(app).get('/uncopyright')
  37. .end(function (err, res) {
  38. expect(res.statusCode).to.equal(200)
  39. done()
  40. })
  41. })
  42. })
  43. describe('# GET /core.css', function () {
  44. it('should get the css file', function (done) {
  45. request(app).get('/core.css')
  46. .end(function (err, res) {
  47. expect(res.statusCode).to.equal(200)
  48. done()
  49. })
  50. })
  51. })
  52. describe('# GET /posts/something-decent', function () {
  53. it('should get the "something-decent" post page', function (done) {
  54. request(app).get('/posts/something-decent')
  55. .end(function (err, res) {
  56. expect(res.statusCode).to.equal(200)
  57. done()
  58. })
  59. })
  60. })
  61. describe('# GET /posts/something-not-here-xxxxx', function () {
  62. it('should get the 404 page via 302 redirect', function (done) {
  63. request(app).get('/posts/something-not-here-xxxxx')
  64. .end(function (err, res) {
  65. expect(res.statusCode).to.equal(302)
  66. done()
  67. })
  68. })
  69. })
  70. describe('# GET /404', function () {
  71. it('should get the 404 page', function (done) {
  72. request(app).get('/404')
  73. .end(function (err, res) {
  74. expect(res.statusCode).to.equal(404)
  75. done()
  76. })
  77. })
  78. })
  79. })