-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
179 additions
and
18 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
web-server/__tests__/plugins/slycat-timeseries-model/plugin-components/LoadingPage.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
import React from 'react'; | ||
import LoadingPage from "slycat-timeseries-model/plugin-components/LoadingPage.tsx"; | ||
import {LoadingPageProps, LoadingPageState} from "slycat-timeseries-model/plugin-components/types.ts"; | ||
import { mount, shallow } from "enzyme"; | ||
|
||
|
||
describe('Timeseries LoadingPage',() =>{ | ||
const render = mount( | ||
<LoadingPage | ||
modelId={'modelID'} | ||
modelState={'waiting'} | ||
jid={'1234'} | ||
hostname={'hostname'} | ||
/> | ||
); | ||
test('should be Defined', () => { | ||
expect(LoadingPage).toBeDefined(); | ||
}); | ||
test('we have expected props on initial load', () => { | ||
const props = render.props() as LoadingPageProps; | ||
expect(props).toMatchSnapshot(); | ||
}); | ||
test('we have expected state on initial load', () => { | ||
const state = render.state() as LoadingPageState; | ||
expect(state).toMatchSnapshot(); | ||
}); | ||
test('we have expected props on initial load', () => { | ||
const myDate = new Date('2019-05-14T11:01:58/135Z'); | ||
global.Date = jest.fn(() => myDate); | ||
const test = shallow( | ||
<LoadingPage | ||
modelId={'modelID'} | ||
modelState={'waiting'} | ||
jid={'1234'} | ||
hostname={'hostname'} | ||
/> | ||
); | ||
expect(test).toMatchSnapshot(); | ||
}); | ||
}); |
120 changes: 120 additions & 0 deletions
120
...plugins/slycat-timeseries-model/plugin-components/__snapshots__/LoadingPage.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Timeseries LoadingPage we have expected props on initial load 1`] = ` | ||
Object { | ||
"hostname": "hostname", | ||
"jid": "1234", | ||
"modelId": "modelID", | ||
"modelState": "waiting", | ||
} | ||
`; | ||
|
||
exports[`Timeseries LoadingPage we have expected props on initial load 2`] = ` | ||
<div | ||
className="slycat-job-checker bootstrap-styles" | ||
> | ||
<div> | ||
<ProgressBar | ||
hidden={false} | ||
progress={0} | ||
/> | ||
</div> | ||
<div | ||
className="slycat-job-checker-controls" | ||
> | ||
<div | ||
className="row" | ||
> | ||
<div | ||
className="col-3" | ||
> | ||
Updated | ||
NaN-NaN-NaN NaN:NaN:NaN | ||
</div> | ||
<div | ||
className="col-2" | ||
> | ||
Job id: | ||
<b> | ||
1234 | ||
</b> | ||
</div> | ||
<div | ||
className="col-3" | ||
> | ||
Remote host: | ||
<b> | ||
hostname | ||
</b> | ||
</div> | ||
<div | ||
className="col-2" | ||
> | ||
Session: | ||
<b> | ||
false | ||
</b> | ||
</div> | ||
<div | ||
className="col-2" | ||
> | ||
<div> | ||
<ConnectModal | ||
callBack={[Function]} | ||
hostname="hostname" | ||
modalId="ConnectModal" | ||
/> | ||
<button | ||
className="btn btn-md btn-primary" | ||
disabled={true} | ||
id="pullbtn" | ||
onClick={[Function]} | ||
title="load data" | ||
type="button" | ||
> | ||
load | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div | ||
className="row" | ||
> | ||
<button | ||
aria-controls="collapseExample" | ||
aria-expanded="false" | ||
className="btn btn-primary" | ||
data-target="#collapseExample" | ||
data-toggle="collapse" | ||
type="button" | ||
> | ||
Show job status meanings | ||
</button> | ||
<JobCodes /> | ||
</div> | ||
</div> | ||
<div | ||
className="slycat-job-checker-output text-white bg-secondary" | ||
> | ||
<Spinner /> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Timeseries LoadingPage we have expected state on initial load 1`] = ` | ||
Object { | ||
"jobStatus": "Job Status Unknown", | ||
"log": Object { | ||
"logLineArray": Array [], | ||
}, | ||
"modalId": "ConnectModal", | ||
"modelId": "modelID", | ||
"modelMessage": "", | ||
"modelShow": false, | ||
"modelState": "waiting", | ||
"progressBarHidden": false, | ||
"progressBarProgress": 0, | ||
"pullCalled": 0, | ||
"sessionExists": false, | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters