Questions tagged [lab]

Lab is a simple test utility for node.

Unlike other test utilities, lab uses domains instead of uncaught exception and other global manipulation. Our goal with lab is to keep the execution engine as simple as possible, and not try to build an extensible framework. lab works with any assertion library that throws an error when a condition isn't met.

Links:

92 questions
0
votes
1 answer

Cannot stub shared object from custom plugin for unit tests

I am using a custom plugin to share a few persistence methods between some hapi modules: const Mongoose = require('mongoose'); const Promise = require('bluebird'); const Models = require('./persistence/mongodb/models'); exports.register =…
Phil
  • 879
  • 2
  • 10
  • 23
0
votes
1 answer

Agent field is set but not run the function in shell shock

I try to solve seed lab shell shock vulnerability lab in that, i set the agent field by bellow command Curl -A "() {echo hello;}; Content_type: text/plain; echo; /bin/ls -l " http://localhost/cgi-bin/sample.cgi The out put is still the hello word…
AliSafari186
  • 113
  • 9
0
votes
1 answer

Understanding Lab coverage and .labrc.js

First thing: I still don't really get the meaning of coverage. Please can somebody explain it to me as if I was a child ? Does it means: any request/handler/response not tested ? Does it means: any function or even any instruction not tested ? I…
acmoune
  • 2,981
  • 3
  • 24
  • 41
0
votes
1 answer

Override Global require on lab testing framework

I'm using hapi's lab+code testing framework. I need to override the global require function. I'm using mockery but I also tried to manually override it without any luck. Seems that lab executes all the code on a sandboxed environment where a special…
Danielo515
  • 5,996
  • 4
  • 32
  • 66
0
votes
1 answer

server.inject with hapijs not return the correct response

I am trying to use Lab to test some code. However, for some reason when I put the right payload my code does nothing. The promise doesn't seem to get returned: 'use strict'; const Server = require('../server'); const options = { method:…
Grouchy
  • 55
  • 1
  • 1
  • 7
0
votes
2 answers

Inconsistent Hapi.js Lab test results

I am trying to test a Hapi.js plugin with registration function: exports.register = function(server, options, next) { server.route({ method: 'POST', path: '/register', config: { payload: { …
Deniz Acay
  • 1,609
  • 1
  • 13
  • 24
0
votes
1 answer

Mongoose model unit testing - Connection wont close if any test cases fail

I'm creating some unit tests for my Mongoose models using Lab and Mockgoose, and I'm having the DB connection opened via Labs lab.before() method, then the database connection killed in labs lab.after() method. The problem I'm running into, is if…
Justin
  • 1,959
  • 5
  • 22
  • 40
0
votes
1 answer

How correct cover this test case in Hapi.js Lab?

I have the file upload POST point in my Hapi.Js server. Here is code: server.route([{ method: 'PUT', path: '/upload/{id}', config: { handler: function(req,res) { async.waterfall([ function…
Roman A.
  • 686
  • 5
  • 25
0
votes
2 answers

Hapi Lab how to test all the required fields

Is there a way to check all the required fields without the need of a test each field. validation rules const Confirmation = Joi.any().valid(Joi.ref('password')).required().options({ language: { any: { allowOnly: 'must match password' } } }); const…
Whisher
  • 31,320
  • 32
  • 120
  • 201
0
votes
1 answer

Issues testing hapijs plugin

Here's my test 'use strict'; var assert = require('assert'); var sinon = require('sinon'); var proxyquire = require('proxyquire'); var Lab = require('lab'); var lab = exports.lab = Lab.script(); lab.experiment("src.mysql", function () { var…
dennismonsewicz
  • 25,132
  • 33
  • 116
  • 189
0
votes
1 answer

Hapi.js lab testing issue

I am new to Hapi.js and node.js in general and am experiencing an issue when trying to code some tests. Project structure: When I run "npm test" i get the following output, how can I fix this?: Thanks in advance!
Jdruwe
  • 3,450
  • 6
  • 36
  • 57
-1
votes
0 answers

How to create a own color management simulation process based on LAB values from RGB to CMYK?

In my printer controller, the red color was not processed properly, I mean customer expectation red color was not matching, but in my controller, it has CMYK simulation processing, like simulate the printer profile with fogra ICC profile. But what…
-1
votes
3 answers

8.9 LAB: Car value (classes)

Complete the Car class by creating an attribute purchase_price (type int) and the method print_info() that outputs the car's information. Ex: If the input is: 2011 18000 2018 where 2011 is the car's model year, 18000 is the purchase price, and 2018…
Ash
  • 1
  • 1
  • 1
-1
votes
1 answer

Lab #3 combining python codes after importing files where do I start?

Need help figuring out where to start after I import my two previous question files. Everything I've tried doesn't seem to want to take. So I scrapped it and trying to figure out where to begin again 1. In a file called FirstName_LastName_Main.py…
-1
votes
1 answer

Virtual lab using Vmware

I am trying to create a virtual lab using Microsoft server 2016 as DNS server and 3 Client virtual machines (Windows 10, Windows 7 & Kali Linux). and i gave them the below static IP v4 Windows Server 2016 client machines Windows 7 the same IP…