Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
checkPath = '/package.json';
expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);
checkFile = getFileContent(tree, checkPath);
// console.log(checkFile);
const packageData: any = jsonParse(checkFile);
expect(packageData.scripts['postinstall']).toBeDefined();
expect(packageData.scripts['postinstall.electron']).toBeDefined();
expect(packageData.scripts['postinstall.web']).toBeDefined();
expect(packageData.scripts['build.electron.foo']).toBeDefined();
expect(packageData.scripts['build.electron.foo.local']).toBeDefined();
expect(packageData.scripts['build.electron.foo.linux']).toBeDefined();
expect(packageData.scripts['build.electron.foo.windows']).toBeDefined();
expect(packageData.scripts['build.electron.foo.mac']).toBeDefined();
expect(packageData.scripts['prepare.electron.foo']).toBeDefined();
expect(packageData.scripts['serve.electron.foo.target']).toBeDefined();
expect(packageData.scripts['serve.electron.foo']).toBeDefined();
expect(packageData.scripts['start.electron.foo']).toBeDefined();
// should *NOT* generate angular specific files
expect(
tree.exists('/apps/web-viewer/src/app/app.electron.module.ts')
).toBeFalsy();
expect(tree.exists('/apps/web-viewer/src/main.electron.ts')).toBeFalsy();
// should create correct files
expect(tree.exists('/apps/web-viewer/src/main.ts')).toBeFalsy();
// make sure start script is correct
checkPath = '/package.json';
checkFile = getFileContent(tree, checkPath);
// console.log(checkFile);
checkPath = '/package.json';
expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);
checkFile = getFileContent(tree, checkPath);
// console.log(checkFile);
const packageData: any = jsonParse(checkFile);
expect(packageData.scripts['postinstall']).toBeDefined();
expect(packageData.scripts['postinstall.electron']).toBeDefined();
expect(packageData.scripts['postinstall.web']).toBeDefined();
expect(packageData.scripts['build.electron.foo']).toBeDefined();
expect(packageData.scripts['build.electron.foo.local']).toBeDefined();
expect(packageData.scripts['build.electron.foo.linux']).toBeDefined();
expect(packageData.scripts['build.electron.foo.windows']).toBeDefined();
expect(packageData.scripts['build.electron.foo.mac']).toBeDefined();
expect(packageData.scripts['prepare.electron.foo']).toBeDefined();
expect(packageData.scripts['serve.electron.foo.target']).toBeDefined();
expect(packageData.scripts['serve.electron.foo']).toBeDefined();
expect(packageData.scripts['start.electron.foo']).toBeDefined();
// check target web app for supporting files
checkPath = '/apps/web-viewer/src/app/app.electron.module.ts';
expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);
checkFile = getFileContent(tree, checkPath);
// console.log(checkFile);
expect(checkFile.indexOf(`TtElectronCoreModule`)).toBeGreaterThanOrEqual(0);
expect(checkFile.indexOf(`AppElectronModule`)).toBeGreaterThanOrEqual(0);
checkPath = '/apps/web-viewer/src/main.electron.ts';
expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);
checkFile = getFileContent(tree, checkPath);