Files
Investidor-V2/outputs/investmoz-parques-mapa-20261016/matrix-tool/node_modules/live-server/test/htpasswd.js
T
nala cef6e201c7
tests / ci (push) Canceled after 0s
versao nrgocios 2
2026-10-16 20:11:05 +02:00

29 lines
755 B
JavaScript

var request = require('supertest');
var path = require('path');
var liveServer = require('..').start({
root: path.join(__dirname, "data"),
port: 0,
open: false,
htpasswd: path.join(__dirname, "data", "htpasswd-test")
});
describe('htpasswd tests', function() {
it('should respond with 401 since no password is given', function(done) {
request(liveServer)
.get('/')
.expect(401, done);
});
it('should respond with 401 since wrong password is given', function(done) {
request(liveServer)
.get('/')
.auth("test", "not-real-password")
.expect(401, done);
});
it('should respond with 200 since correct password is given', function(done) {
request(liveServer)
.get('/')
.auth("test", "test")
.expect(200, done);
});
});