Skip to content

Commit 18372cf

Browse files
committed
cleaned up testing branch (feature/checkbox), removed console logs
Co-authored-by: Philip Hua <[email protected]> Co-authored-by: Miles Wright <[email protected]> Co-authored-by: William Rittwage <[email protected]> Co-authored-by: Daniel Reilley <[email protected]>
1 parent 75fa9ba commit 18372cf

File tree

11 files changed

+14
-43
lines changed

11 files changed

+14
-43
lines changed

app/electron/main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ app.on('ready', createWindow);
204204

205205
// Quit when all windows are closed.
206206
app.on('window-all-closed', () => {
207-
require('electron').app.getPath('userData');
208207
win.webContents.executeJavaScript('window.localStorage.clear();');
209208
app.quit();
210209
});

app/src/components/right/ExportButton.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ export default function ExportButton() {
8787
// when a directory is chosen, the callback will export the project to the chosen folder
8888
// Note: this listener is imported from the main process via preload.js
8989
window.api.addAppDirChosenListener(path => {
90-
// console.log(testchecked);
9190
exportProject(
9291
path,
9392
state.name

app/src/helperFunctions/generateCode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const generateUnformattedCode = (
188188
.join('\n')
189189
: imports
190190
.map((comp: string) => {
191-
return `import ${comp} from './${comp}.tsx'`;
191+
return `import ${comp} from './${comp}'`;
192192
})
193193
.join('\n');
194194

app/src/utils/createApplication.util.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,7 @@ async function createApplicationUtil({
376376
await createTsLint(path, appName);
377377
await createServer(path, appName);
378378
if (testchecked) {
379-
console.log('entering createTestSuiteClassic');
380-
await createTestSuiteClassic({path, appName, components, testchecked});
379+
await createTestSuiteClassic({path, appName, components, testchecked});
381380
}
382381
await createFiles(components, path, appName, true);
383382
}

app/src/utils/createGatsbyApp.util.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const compToCSS = (component: Component) => {
2626

2727
//createPackage
2828
export const createPackage = (path, appName, test) => {
29-
// console.log('in createpackage: ',test);
3029
const filePath = `${path}/${appName}/package.json`;
3130

3231
let tsjest = `,
@@ -36,7 +35,6 @@ export const createPackage = (path, appName, test) => {
3635
"enzyme": "^3.11.0",
3736
"enzyme-adapter-react-16": "^1.15.6",
3837
"jest": "^27.2.0",
39-
"react-test-renderer": "^17.0.2",
4038
"@types/react-dom": "^17.0.9",
4139
"@types/enzyme-adapter-react-16": "^1.0.6",
4240
"@types/react-test-renderer": "^17.0.1",
@@ -191,7 +189,6 @@ async function createGatsbyAppUtil({
191189
await createPackage(path, appName, testchecked);
192190
await createTsConfig(path, appName);
193191
if (testchecked) {
194-
console.log('testchecked: ',testchecked);
195192
await createTestSuite({path, appName, components, rootComponents, testchecked});
196193
}
197194
await createGatsbyFiles(components, path, appName, rootComponents);

app/src/utils/createNextApp.util.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ async function createNextAppUtil({
212212
await createPackage(path, appName, testchecked);
213213
await createTsConfig(path, appName);
214214
if (testchecked) {
215-
console.log('testchecked: ',testchecked);
216215
await createTestSuiteNext({path, appName, components, rootComponents, testchecked});
217216
}
218217
await createNextFiles(components, path, appName, rootComponents);

app/src/utils/createTestSuite.util.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// create config files
33
// add webpack dependencies
44
// create tests for components
5-
// const createTestSuite = () => {
6-
// console.log('creating test suites');
7-
// }
85

96
const initFolders = (path: string, appName: string) => {
107
let dir = path;
@@ -120,12 +117,9 @@ async function createJestPreprocessFile(path: string, appName: string){
120117

121118
async function createComponentTests(path: string, appName: string, components: Component[]) {
122119
const filePath: string = `${path}/${appName}/__tests__/test.tsx`;
123-
console.log(JSON.stringify(components))
124-
console.log(components);
125120

126121
let data:string = `
127122
import React from "react"
128-
import renderer from "react-test-renderer"
129123
import Enzyme, { shallow } from 'enzyme';
130124
131125
@@ -135,9 +129,17 @@ async function createComponentTests(path: string, appName: string, components: C
135129

136130
components.forEach(page => {
137131

138-
let importString = `
132+
let importString = ''
133+
if (page.isPage) {
134+
135+
importString = `
139136
import ${capitalize(page.name)} from "../src/pages/${page.name}";`;
140-
data = data + importString;
137+
data = data + importString;
138+
} else {
139+
importString = `
140+
import ${capitalize(page.name)} from "../src/components/${page.name}";`;
141+
data = data + importString;
142+
}
141143
})
142144

143145
//let describe = `describe("${page.name}", () => {`
@@ -149,10 +151,8 @@ async function createComponentTests(path: string, appName: string, components: C
149151

150152
data = data + `
151153
it("renders correctly", () => {
152-
const tree = renderer
153-
.create(<${capitalize(page.name)} />)
154-
.toJSON()
155-
expect(tree).toMatchSnapshot()
154+
const tree = shallow(<${capitalize(page.name)} />);
155+
expect(tree).toMatchSnapshot();
156156
})`
157157

158158

@@ -189,9 +189,6 @@ async function createTestSuite({
189189
rootComponents: number[];
190190
testchecked: boolean;
191191
}) {
192-
console.log('in the createGatsbyApplication util');
193-
console.log('testchecked: ', testchecked);
194-
195192
await initFolders(path, appName);
196193
await createMocksFiles(path, appName);
197194
await createTestsFiles(path, appName);

app/src/utils/createTestSuiteClassic.util.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
const initFolders = (path: string, appName: string) => {
5-
console.log(window); // remember to delete
65
let dir = path;
76
dir = `${dir}/${appName}`;
87
if (!window.api.existsSync(`${dir}/__tests__`)) {
@@ -53,8 +52,6 @@ const createJestPreprocessFile = (path: string, appName: string) => {
5352

5453
async function createComponentTests(path: string, appName: string, components: Component[]) {
5554
const filePath: string = `${path}/${appName}/__tests__/test.tsx`;
56-
console.log(JSON.stringify(components))
57-
console.log(components);
5855

5956
let data:string = `
6057
import { shallow } from 'enzyme'
@@ -146,9 +143,6 @@ async function createTestSuiteClassic({
146143
components: Component[];
147144
testchecked: boolean;
148145
}) {
149-
console.log('in the createClassicApplication util');
150-
console.log('testchecked: ', testchecked);
151-
152146
await initFolders(path, appName);
153147
await createJestConfigFile(path, appName);
154148
await createJestPreprocessFile(path, appName);

app/src/utils/createTestSuiteNext.util.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ module.exports = {
5959
};
6060

6161
async function createJestTsconfigJsonFile(path: String, appName: String){
62-
console.log('got in create jest tsconfig');
6362
const filePath:string = `${path}/${appName}/jest.tsconfig.json`;
6463
const data:string = `
6564
{
@@ -88,7 +87,6 @@ async function createJestTsconfigJsonFile(path: String, appName: String){
8887
]
8988
}
9089
`;
91-
console.log(data);
9290
window.api.writeFile(filePath, data, err => {
9391
if (err) {
9492
console.log('createTestSuiteNext.util createJestTsconfigJsonFile error:', err.message);
@@ -133,16 +131,13 @@ require('enzyme').configure({adapter: new Adapter()});`;
133131

134132
async function createComponentTests(path: string, appName: string, components: Component[]) {
135133
const filePath: string = `${path}/${appName}/__tests__/test.tsx`;
136-
console.log(JSON.stringify(components))
137-
console.log(components);
138134

139135
let data:string = `
140136
import { shallow } from 'enzyme'
141137
import React from 'react';
142138
`;
143139

144140
components.forEach(page => {
145-
console.log(page);
146141
let importString = '';
147142
if (page.isPage) {
148143
importString = `
@@ -202,12 +197,7 @@ async function createTestSuite({
202197
rootComponents: number[];
203198
testchecked: boolean;
204199
}) {
205-
console.log('in the createGatsbyApplication util');
206-
console.log('testchecked: ', testchecked);
207-
208200
await initFolders(path, appName);
209-
// await createMocksFiles(path, appName);
210-
// await createTestsFiles(path, appName);
211201
await createJestConfigFile(path, appName);
212202
await createJestTsconfigJsonFile(path, appName);
213203
await createJestPreprocessFile(path, appName);

server/graphQL/resolvers/query.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const { Projects, Comments } = require('../../models/reactypeModels');
77
const Project = {
88
getProject: async (parent, { projId }) => {
99
const resp = await Projects.findOne({ _id: projId });
10-
// console.log('getProject return >>> ', resp);
1110
if (resp) {
1211
return ({
1312
name: resp.name,
@@ -29,7 +28,6 @@ const Project = {
2928

3029
getAllProjects: async (parent, { userId }) => {
3130
let resp = await Projects.find({});
32-
// console.log('getAllProjects resp >>> ', resp);
3331
if (userId) {
3432
// use loosely equal for the callback because there are some discrepancy between the type of userId from the db vs from the mutation query
3533
resp = resp.filter(proj => proj.userId == userId);

server/server.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ app.get(
5555
if (isDev) {
5656
return res.status(200).redirect(`http://localhost:8080?=${res.locals.ssid}`);
5757
} else {
58-
console.log('res.locals.ssid: ',res.locals.ssid);
5958
return res.status(200).redirect(`app://rse?=${res.locals.ssid}`);
6059
}
6160
}

0 commit comments

Comments
 (0)