proxyquire Questions
6
I've been using Knex successfully to connect to a backend database. But I want to be able to unit test my code. Is there a way to mock the database connection?
I've tried using proxyquire but I ca...
Playacting asked 27/1, 2015 at 7:9
3
Solved
Using proxyquire, sinon, and mocha.
I am able to stub fetch on the first call of fetch. But on the second fetch call, which is recursive, I am not able to assert it. From the output, it looks lik...
Hystero asked 29/4, 2017 at 1:17
0
I'm trying to use proxyquire to replace a private function for testing in my Meteor app.
Meteor 1.6.1
meteortesting:[email protected]
In my parentFunction.js:
import { some function } from...
Glasser asked 26/3, 2019 at 10:3
3
I have installed proxyquire and my ajax.test.tsx file contains the following code, just 2 lines
import * as proxyquire from 'proxyquire';
proxyquire.noCallThru();
My webpack code is the followin...
Vein asked 10/4, 2017 at 10:55
1
I want to unit test the exported method in the code below. I want to mock the values in the private method to control the reject/resolves of the returned Promise. client is node-postgres object tha...
Hayman asked 3/3, 2017 at 21:21
1
Solved
If we have three modules names A, B and C so module A requires B and B requires C: what would be the effect of this call?
var A = proxyquire('A', {'C': mockedModule})
Would module B get the mock...
Foretop asked 29/5, 2014 at 23:45
1
Solved
I have a class AProvider that requires './b.provider'.
const BProvider = require('./b.provider');
class AProvider {
static get defaultPath() {
return `defaults/a/${BProvider.getThing()}`;
}
}
...
Stilu asked 2/3, 2017 at 8:21
1
I want to unit-test the following simplified module:
const Logger = require('logplease');
const logger = Logger.create('utils');
const tester = {
one: () => {
logger.log('called real one()'...
Chainman asked 10/2, 2017 at 21:36
1
Solved
I have the following in Express
//index.js
var service = require('./subscription.service');
var auth = require('../auth/auth.service');
var router = express.Router();
router.post('/sync', a...
Avelinaaveline asked 2/2, 2017 at 6:21
1
I need to somehow mock the document object to be able to unit-test a legacy TypeScript class. The class imports another class (View.ts), which has an import of a 3-rd party module, and that, in tur...
Garibold asked 12/12, 2016 at 15:34
3
Solved
Client side I stub out paths to modules with SystemJS, like this
var systemJsConfig = {
baseURL: "./",
defaultJSExtensions: true,
map: {
'root-components': 'applicationRoot/rootComponents'
}
...
Modena asked 2/6, 2016 at 15:17
2
Solved
I have these files:
File1.js
var mod1 = require('mod1');
mod1.someFunction()
...
File2.js
var File1 = require('./File1');
Now while writing unit tests for File2, is it possible to have mod1 ...
Govern asked 1/2, 2016 at 19:40
0
For some reason proxquire cannot find my module index.js. I must be doing something really stupid or obvious and can't see it.
Error:
invoicer
good request
1) "before all" hook
0 passing (9...
Beare asked 24/4, 2015 at 15:37
1
Solved
When mocking Node dependencies, I've happened upon the following libraries:
Proxyquire
Rewire
SandboxedModule
Sinon
They all seem to do more-or-less the same thing: allow you to mock require() ...
Kalina asked 12/6, 2014 at 17:2
1
© 2022 - 2024 — McMap. All rights reserved.