Skip to content

Commit 7c9883c

Browse files
committed
Fix failing tests
1 parent 6dee82d commit 7c9883c

File tree

13 files changed

+157
-135
lines changed

13 files changed

+157
-135
lines changed

.idea/shelf/Uncommitted_changes_before_Update_at_17_06_20__7_26_PM__Default_Changelist_.xml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.idea/shelf/Uncommitted_changes_before_rebase__Default_Changelist_.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/containers/DefaultLayout/__snapshots__/DefaultLayout.test.js.snap

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,21 @@ exports[`Remote Explorer renders should match snapshot 1`] = `
7676
"name": "Backend",
7777
"url": "/rcloneBackend",
7878
},
79+
Object {
80+
"icon": "fa fa-plug",
81+
"name": "Plugins",
82+
"url": "/pluginDashboard",
83+
},
7984
Object {
8085
"icon": "fa fa-hdd-o",
8186
"name": "Mounts",
8287
"url": "/mountDashboard",
8388
},
89+
Object {
90+
"icon": "fa fa-terminal",
91+
"name": "Terminal",
92+
"url": "/terminal",
93+
},
8494
Object {
8595
"icon": "icon-logout",
8696
"name": "Log Out",
@@ -204,6 +214,16 @@ exports[`Remote Explorer renders should match snapshot 1`] = `
204214
"name": "Rclone Backend",
205215
"path": "/rcloneBackend",
206216
},
217+
Object {
218+
"component": Object {
219+
"$$typeof": Symbol(react.lazy),
220+
"_ctor": [Function],
221+
"_result": null,
222+
"_status": -1,
223+
},
224+
"name": "Plugins",
225+
"path": "/pluginDashboard",
226+
},
207227
Object {
208228
"component": Object {
209229
"$$typeof": Symbol(react.lazy),
@@ -214,6 +234,26 @@ exports[`Remote Explorer renders should match snapshot 1`] = `
214234
"name": "Mount Dashboard",
215235
"path": "/mountDashboard",
216236
},
237+
Object {
238+
"component": Object {
239+
"$$typeof": Symbol(react.lazy),
240+
"_ctor": [Function],
241+
"_result": null,
242+
"_status": -1,
243+
},
244+
"name": "Store Dashboard",
245+
"path": "/storeDashboard",
246+
},
247+
Object {
248+
"component": Object {
249+
"$$typeof": Symbol(react.lazy),
250+
"_ctor": [Function],
251+
"_result": null,
252+
"_status": -1,
253+
},
254+
"name": "Terminal",
255+
"path": "/terminal",
256+
},
217257
]
218258
}
219259
className=""
@@ -286,10 +326,28 @@ exports[`Remote Explorer renders should match snapshot 1`] = `
286326
/>
287327
<Route
288328
key="9"
329+
name="Plugins"
330+
path="/pluginDashboard"
331+
render={[Function]}
332+
/>
333+
<Route
334+
key="10"
289335
name="Mount Dashboard"
290336
path="/mountDashboard"
291337
render={[Function]}
292338
/>
339+
<Route
340+
key="11"
341+
name="Store Dashboard"
342+
path="/storeDashboard"
343+
render={[Function]}
344+
/>
345+
<Route
346+
key="12"
347+
name="Terminal"
348+
path="/terminal"
349+
render={[Function]}
350+
/>
293351
<Redirect
294352
from="/"
295353
to="/dashboard"

src/views/Base/Widgets/VideoPlayer/VideoPlayer.js

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as ReactDOM from "react-dom";
44
import {MODAL_ROOT_ELEMENT} from "../../../../utils/Constants";
55
import * as PropTypes from "prop-types";
66
import ErrorBoundary from "../../../../ErrorHandling/ErrorBoundary";
7-
import Iframe from 'react-iframe'
87

98
import ReactAwesomePlayer from 'react-awesome-player'
109
import {connect} from "react-redux";
@@ -79,21 +78,21 @@ function VideoPlayer({playbackURL, MimeType, loadedTestPlugins}) {
7978
const subtitleURL = playbackURL.substring(0, playbackURL.lastIndexOf('.')) + ".vtt";
8079
console.log(subtitleURL);
8180

82-
// const options = {
83-
// options: {
84-
// sources: [{
85-
// type: MimeType,
86-
// src: playbackURL
87-
// }],
88-
// subtitles: [
89-
// {
90-
// language: 'en',
91-
// url: subtitleURL,
92-
// label: "EN"
93-
// }],
94-
// }
95-
// };
96-
//
81+
const options = {
82+
options: {
83+
sources: [{
84+
type: MimeType,
85+
src: playbackURL
86+
}],
87+
subtitles: [
88+
{
89+
language: 'en',
90+
url: subtitleURL,
91+
label: "EN"
92+
}],
93+
}
94+
};
95+
9796

9897
element =
9998
ReactDOM.createPortal(
@@ -103,21 +102,10 @@ function VideoPlayer({playbackURL, MimeType, loadedTestPlugins}) {
103102
{/*<video id="video" controls preload="metadata" width="600">*/}
104103
{/* <source src={playbackURL} type={MimeType}/>*/}
105104
{/*</video>*/}
106-
{/*<PlayerComponent {...options}/>*/}
107-
<Iframe url={`${pluginUrl}?loadUrl=${playbackURL}&mimeType=${MimeType}`}
108-
allowTransparency="true"
109-
allowFullScreen="true"
110-
width="100%"
111-
height="100%"
112-
display="initial"
113-
position="relative"/>
114-
<Button color="link" onClick={hideFull} className="modal-button">
115-
<i
116-
className="fa fa-close fa-3x"
117-
/>
118-
</Button>
105+
<PlayerComponent {...options}/>
106+
119107
</div>
120-
<div className="modal-backdrop fade show"></div>
108+
{/*<div className="modal-backdrop fade show"></div>*/}
121109

122110

123111
</>, document.getElementById(MODAL_ROOT_ELEMENT));
@@ -127,7 +115,7 @@ function VideoPlayer({playbackURL, MimeType, loadedTestPlugins}) {
127115
<ErrorBoundary>
128116
{element}
129117
</ErrorBoundary>
130-
)
118+
);
131119

132120

133121
}

src/views/Base/Widgets/VideoPlayer/VideoPlayer.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import VideoPlayer from "./VideoPlayer";
77
const setUp = (intialState = {}, props = {}) => {
88
const store = testStore(intialState);
99
const component = shallow(<VideoPlayer {...props} store={store}/>);
10-
return component;
10+
return component.childAt(0).dive();
1111
};
1212

1313

14-
describe('Video Player Widget', function () {
14+
describe('Video Player', function () {
1515

1616

1717
describe('renders', function () {
Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Video Player Widget renders should match snapshot 1`] = `
4-
<ContextProvider
5-
value={null}
6-
>
7-
<VideoPlayer
8-
MimeType=""
9-
loadedTestPlugins={Object {}}
10-
playbackURL=""
11-
store={
12-
Object {
13-
"dispatch": [Function],
14-
"getState": [Function],
15-
"replaceReducer": [Function],
16-
"subscribe": [Function],
17-
Symbol(observable): [Function],
18-
}
19-
}
20-
/>
21-
</ContextProvider>
3+
exports[`Video Player renders should match snapshot 1`] = `
4+
<ErrorBoundary>
5+
<div
6+
className="img-thumbnail w-100 text-center"
7+
data-test="videoPlayerWidget"
8+
>
9+
<Button
10+
color="link"
11+
onClick={[Function]}
12+
tag="button"
13+
>
14+
<i
15+
className="fa fa-play-circle fa-4x"
16+
/>
17+
</Button>
18+
</div>
19+
</ErrorBoundary>
2220
`;

src/views/DashboardPluginWidgets/DashboardPluginWidgets.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ function DashboardPluginWidgets({loadedPlugins, getPlugins}) {
2323
let dashboardPlugins = getPluginsArray(loadedPlugins);
2424
dashboardPlugins = filterPluginsByType(dashboardPlugins, pluginTypes.DASHBOARD)
2525
setDashboardWidgets(dashboardPlugins);
26-
}, [])
26+
}, [getPlugins, loadedPlugins])
2727

2828

2929
return (
3030
<Row>
31-
{dashboardWidgets.map(element => <Col lg={6}>
31+
{dashboardWidgets.map(element => <Col lg={6} key={element.author + "/" + element.name}>
3232
<DashboardPlugin pluginUrl={getPluginBaseUrl(getIPAddress(), element.name, element.author)}/>
3333
</Col>)}
3434
</Row>

src/views/Home/__snapshots__/Home.test.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ exports[`Home Component renders should match snapshot 1`] = `
5252
<Connect(BandwidthStatusCard) />
5353
</Col>
5454
</Row>
55+
<Connect(DashboardPluginWidgets) />
5556
<h2>
5657
Jobs
5758
</h2>

src/views/StoreDashboard/PluginPlaceHolderCard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function PluginPlaceHolderCard({plugin}) {
3232
<CardBody>
3333
<Row>
3434
<Col lg={3} className="d-none d-md-block">
35-
<img style={{width: "100%"}}
35+
<img style={{width: "100%"}} alt={icon ? name + " Icon" : 'rclone logo'}
3636
src={icon ? icon : require("../../assets/img/brand/logo_symbol.png")}/>
3737
</Col>
3838
<Col lg={6} sm={12} md={6}>

src/views/StoreDashboard/StoreDashboard.js

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,44 +37,49 @@ class StoreDashboard extends React.Component {
3737
render() {
3838
const {pluginsList, searchQuery} = this.state;
3939
const {getPlugins} = this.props;
40+
41+
let element = null;
4042
if (pluginsList.length <= 0) {
41-
return (<p>Loading</p>)
42-
}
43-
const filteredList = pluginsList ? pluginsList.filter(element => {
44-
return (
45-
element.name.toLowerCase().includes(searchQuery) ||
46-
element.description.toLowerCase().includes(searchQuery) ||
47-
element.longDescription.toLowerCase().includes(searchQuery) ||
48-
element.author.toLowerCase().includes(searchQuery)
49-
);
50-
}) : [];
51-
return (
52-
<div data-test="storeDashboardComponent">
53-
<Row>
54-
<Col lg={12} className="mb-4 d-flex justify-content-between">
55-
<Button color="secondary" onClick={() => this.props.history.goBack()}>Back</Button>
56-
<Form inline onSubmit={(e) => e.preventDefault()}>
57-
<InputGroup>
58-
<Input placeholder="Type to start searching" type="text" value={searchQuery}
59-
onChange={(e) => this.setState({searchQuery: e.target.value})}/>
60-
<InputGroupAddon addonType="append"><Button color="primary"><span
61-
className="fa fa-search"/></Button></InputGroupAddon>
62-
</InputGroup>
43+
element = (<p>Loading</p>);
44+
} else {
45+
const filteredList = pluginsList ? pluginsList.filter(element => {
46+
return (
47+
element.name.toLowerCase().includes(searchQuery) ||
48+
element.description.toLowerCase().includes(searchQuery) ||
49+
element.longDescription.toLowerCase().includes(searchQuery) ||
50+
element.author.toLowerCase().includes(searchQuery)
51+
);
52+
}) : [];
53+
element = (
54+
<>
55+
<Row>
56+
<Col lg={12} className="mb-4 d-flex justify-content-between">
57+
<Button color="secondary" onClick={() => this.props.history.goBack()}>Back</Button>
58+
<Form inline onSubmit={(e) => e.preventDefault()}>
59+
<InputGroup>
60+
<Input placeholder="Type to start searching" type="text" value={searchQuery}
61+
onChange={(e) => this.setState({searchQuery: e.target.value})}/>
62+
<InputGroupAddon addonType="append"><Button color="primary"><span
63+
className="fa fa-search"/></Button></InputGroupAddon>
64+
</InputGroup>
6365

6466

65-
</Form>
66-
</Col>
67-
</Row>
68-
<Row>
69-
{
70-
filteredList.map((e) =>
71-
<Col lg={6} key={e.name}>
72-
<PluginPlaceHolderCard plugin={e} getPlugins={getPlugins}/>
73-
</Col>
74-
)
75-
}
76-
</Row>
77-
</div>);
67+
</Form>
68+
</Col>
69+
</Row>
70+
<Row>
71+
{
72+
filteredList.map((e) =>
73+
<Col lg={6} key={e.name}>
74+
<PluginPlaceHolderCard plugin={e} getPlugins={getPlugins}/>
75+
</Col>
76+
)
77+
}
78+
</Row>
79+
</>
80+
);
81+
}
82+
return <div data-test="storeDashboardComponent">${element}</div>
7883
}
7984
}
8085

0 commit comments

Comments
 (0)