Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{
encoding: 'utf8'
}
);
// Ensure the TypeScript config file is written to disk.
expect(writeJSONSpy).toHaveBeenCalledWith(
skyPagesConfigUtil.spaPathTempSrc('tsconfig.json'),
jasmine.objectContaining({
'files': [
'./app/app.module.ts'
]
})
);
mock.stop(f);
});
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);
});
/**
* @file utils.js test case
* @author xuexb
*/
require('mock-require').stopAll()
const utils = require('../src/utils')
const expect = require('chai').expect
describe('utils.js', () => {
describe('.toArray', () => {
it('should return self if empty', () => {
expect(utils.toArray()).to.be.undefined
expect(utils.toArray('')).to.equal('')
expect(utils.toArray(null)).to.be.null
})
it('should return array if not the empty string', () => {
expect(utils.toArray(['string'])).to.be.a('array').and.to.deep.equal(['string'])
expect(utils.toArray('string')).to.be.a('array').and.to.deep.equal(['string'])
})
})
return npmTranslator.generateDependencyTree(applicationAPath).then((parsedTree) => {
t.deepEqual(parsedTree, applicationATree, "Parsed correctly");
mock.stop("@ui5/logger");
});
});