Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(() => {
// Mock out the "require" calls in the module under test
fsMock = { readFileSync: simpleMock.stub() };
mockRequire('fs', fsMock);
vmMock = { runInThisContext: simpleMock.stub() };
mockRequire('vm', vmMock);
testEnvironmentMaker = mockRequire.reRequire('./test-environment-maker');
});
beforeEach(function() {
// Mock out the "require" calls in the module under test
fsMock = { readFileSync: simpleMock.stub() };
mockRequire('fs', fsMock);
fileFragmentLoader = mockRequire.reRequire('./file-fragment-loader.js');
});
it('should expose a getWebpackConfig method', () => {
const lib = mock.reRequire(configPath);
expect(typeof lib.getWebpackConfig).toEqual('function');
});
it('should return a config object', () => {
const lib = mock.reRequire(configPath);
const config = lib.getWebpackConfig(skyPagesConfig);
expect(config).toEqual(jasmine.any(Object));
});
it('should expose a runCommand method', () => {
const lib = mock.reRequire('../index');
expect(typeof lib.runCommand).toEqual('function');
});
it('requires common config file', () => {
//setup
process.env.NODE_ENV = 'dev';
//exercise
config = Mock.reRequire('config');
//verify
expect(config).to.be.an.object();
expect(config.common).to.be.a.boolean();
expect(config.common).to.equals(true);
});
beforeEach(()=>{
fakeHighcharts = {};
console.log(modulename);
mock(modulename, fakeHighcharts);
Component = mock.reRequire('../../' + libPath);
});
before(() => {
Config = require('config');
mailConfig = Config.mail;
smtpConfig = Config.smtp;
Mock('plugins/logger', Logger);
Mailer = Mock.reRequire('plugins/mailer');
});
beforeEach(() => {
mock('../config/sky-pages/sky-pages.config', {
spaPath: (...segments) => segments.join('/'),
spaPathTempSrc: () => '',
spaPathTemp: () => ''
});
util = mock.reRequire('../cli/utils/prepare-library-package');
});
beforeEach(() => {
lib = mock.reRequire('../config/protractor/protractor.conf.js');
config = lib.config;
});