Skip to content

Commit 6842d2d

Browse files
Rachel YooRachel Yoo
authored andcommitted
merged with staging
1 parent 17aa39e commit 6842d2d

File tree

7 files changed

+60
-26
lines changed

7 files changed

+60
-26
lines changed

src/App.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ const App = () => {
7575
*/
7676
<div id={global.isFileDirectoryOpen ? styles.appGridOpen : styles.appGridClose}>
7777
<GlobalContext.Provider value={[global, dispatchToGlobal]}>
78-
{/* value wrapped in array since Provider only takes in one value */}
7978
<TestCaseContext.Provider value={[testCase, dispatchToTestCase]}>
8079
<ReduxTestCaseContext.Provider value={[reduxTestCase, dispatchToReduxTestCase]}>
8180
<EndpointTestCaseContext.Provider

src/containers/NavBar/FileDirectory/FileDirectory.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* left hand window pane for file tree
3-
*/
4-
51
import React, { useContext } from 'react';
62
import styles from './FileDirectory.module.scss';
73
import { GlobalContext } from '../../../context/globalReducer';

src/containers/ProjectLoader/ProjectLoader.jsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/**
2-
* Spearmint app homepage
3-
* to import a project file or enter url
4-
*/
5-
61
import React, { useContext } from 'react';
72
import styles from './ProjectLoader.module.scss';
83
import { GlobalContext } from '../../context/globalReducer';

src/containers/ProjectLoader/__tests__/projectLoader.test.js

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,65 @@
1-
test('displays browser view of when URL is correctly inputted', () => {});
1+
import React from 'react';
2+
import { GlobalContext } from '../../../context/globalReducer';
3+
import BrowserView from '../../RightPanel/BrowserView/BrowserView';
4+
import EditorView from '../../RightPanel/EditorView/EditorView';
5+
import RightPanel from '../../RightPanel/RightPanel';
26

3-
test(`omitting 'www' from URL still displays browser view`, () => {});
7+
import { render, fireEvent } from '@testing-library/react';
8+
import { build, fake } from 'test-data-bot';
9+
import '@testing-library/jest-dom/extend-expect';
410

5-
test('localhost URL displays on the browser view', () => {});
11+
import Enzyme from 'enzyme';
12+
import { shallow, mount } from 'enzyme';
13+
import ReactDOM from 'react-dom';
14+
import { act } from 'react-dom/test-utils';
15+
16+
import { configure } from 'enzyme';
17+
import Adapter from 'enzyme-adapter-react-16';
18+
import { exportAllDeclaration } from '@babel/types';
19+
20+
Enzume.configure({ adapter: new Adapter() });
21+
22+
let globalM = {
23+
url: null,
24+
isProjectLoaded: false,
25+
fileTree: null,
26+
componentName: '',
27+
isFileDirectoryOpen: true,
28+
rightPanelDisplay: 'browserView',
29+
displayedFileCode: '',
30+
isFolderOpen: {},
31+
isFileHighlighted: '',
32+
projectFilePath: '',
33+
filePathMap: {},
34+
};
35+
36+
let dispatchToGlobal = jest.fn();
37+
38+
let wrapper = mount(
39+
<GlobalContext.Provider value={[globalM, dispatchToGlobal]}>
40+
<ProjectLoader />
41+
<Navbar>
42+
<FileDirectory />
43+
</Navbar>
44+
<RightPanel>
45+
<BrowserView />
46+
<EditorView />
47+
</RightPanel>
48+
</GlobalContext.Provider>
49+
);
50+
51+
test('displays browser view of when URL is correctly inputted', () => {
52+
globalM.url !== null;
53+
const browserViewComponent = wrapper.find(<BrowserView />);
54+
expect(browserViewComponent).toMatchSnapshot();
55+
});
56+
57+
test(`omitting 'www' from URL still displays browser view`, () => {
58+
const addHttps = wrapper.find(addHttps());
59+
addHttps(!url.startsWith('www'));
60+
const browserViewComponent = wrapper.find(<BrowserView />);
61+
expect(browserViewComponent).toMatchSnapshot();
62+
});
663

764
test('displays file directory of project that is loaded', () => {});
865

src/containers/RightPanel/BrowserView/BrowserView.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* right pane editor view (shows the code of whatever link you're using)
3-
*/
4-
51
import React, { useContext } from 'react';
62
import styles from './BrowserView.module.scss';
73
import { GlobalContext } from '../../../context/globalReducer';

src/containers/RightPanel/EditorView/EditorView.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* right pane editor view (shows the code fof whatever file you click on)
3-
*/
4-
51
import React, { useContext } from 'react';
62
import MonacoEditor from 'react-monaco-editor';
73
import { GlobalContext } from '../../../context/globalReducer';

src/containers/RightPanel/RightPanel.jsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/**
2-
* main component for right panel
3-
* renders either browser or editor view
4-
*/
5-
61
import React, { useContext } from 'react';
72
import styles from './RightPanel.module.scss';
83
import EditorView from './EditorView/EditorView';

0 commit comments

Comments
 (0)