Answer the question
In order to leave comments, you need to log in
How do express.js app tests work?
Deployed this repository locally:
https://gitlab.com/gitlab-org/project-templates/express
The index.js file replaced:
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'bengur2' }); // тут вставил ник
});
module.exports = router;
yarn test
Error: expected body '<!DOCTYPE html><html><head><title>bengur2</title><link rel="stylesheet" href="/stylesheets/style.css"></head><body><h1>bengur2</h1><p>Welcome to bengur2</p></body></html>' to match /Welcome to Express/
it('has the default page', function(done) {
request(app)
.get('/')
.expect(/Welcome to Express/, done);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question