-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ReactComponents): configure table, kpi and status to always fetch…
… raw data
- Loading branch information
Showing
14 changed files
with
142 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
30 changes: 30 additions & 0 deletions
30
packages/react-components/src/components/dial/dial.spec.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,30 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { mockTimeSeriesDataQuery } from '@iot-app-kit/testing-util'; | ||
import { Dial } from './dial'; | ||
|
||
const VIEWPORT = { duration: '5m' }; | ||
|
||
const LATEST_VALUE = 123.2; | ||
const DATA_STREAM = { | ||
id: 'abc-1', | ||
data: [{ x: new Date(2000, 0, 0).getTime(), y: LATEST_VALUE }], | ||
resolution: 0, | ||
name: 'some name', | ||
unit: 'mph', | ||
}; | ||
|
||
it('renders', async () => { | ||
const query = mockTimeSeriesDataQuery([ | ||
{ | ||
dataStreams: [DATA_STREAM], | ||
viewport: VIEWPORT, | ||
thresholds: [], | ||
}, | ||
]); | ||
|
||
render(<Dial query={query} viewport={VIEWPORT} />); | ||
|
||
expect(screen.queryByText(DATA_STREAM.unit)).not.toBeNull(); | ||
expect(screen.queryByText(LATEST_VALUE)).not.toBeNull(); | ||
}); |
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
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,30 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { mockTimeSeriesDataQuery } from '@iot-app-kit/testing-util'; | ||
import { Kpi } from './kpi'; | ||
|
||
const VIEWPORT = { duration: '5m' }; | ||
|
||
const LATEST_VALUE = 123.2; | ||
const DATA_STREAM = { | ||
id: 'abc-1', | ||
data: [{ x: new Date(2000, 0, 0).getTime(), y: LATEST_VALUE }], | ||
resolution: 0, | ||
name: 'some name', | ||
unit: 'mph', | ||
}; | ||
|
||
it('renders', async () => { | ||
const query = mockTimeSeriesDataQuery([ | ||
{ | ||
dataStreams: [DATA_STREAM], | ||
viewport: VIEWPORT, | ||
thresholds: [], | ||
}, | ||
]); | ||
|
||
render(<Kpi query={query} viewport={VIEWPORT} />); | ||
|
||
expect(screen.queryByText(DATA_STREAM.unit)).not.toBeNull(); | ||
expect(screen.queryByText(LATEST_VALUE)).not.toBeNull(); | ||
}); |
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
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
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
30 changes: 30 additions & 0 deletions
30
packages/react-components/src/components/status/status.spec.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,30 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { mockTimeSeriesDataQuery } from '@iot-app-kit/testing-util'; | ||
import { Status } from './status'; | ||
|
||
const VIEWPORT = { duration: '5m' }; | ||
|
||
const LATEST_VALUE = 123.2; | ||
const DATA_STREAM = { | ||
id: 'abc-1', | ||
data: [{ x: new Date(2000, 0, 0).getTime(), y: LATEST_VALUE }], | ||
resolution: 0, | ||
name: 'some name', | ||
unit: 'mph', | ||
}; | ||
|
||
it('renders', async () => { | ||
const query = mockTimeSeriesDataQuery([ | ||
{ | ||
dataStreams: [DATA_STREAM], | ||
viewport: VIEWPORT, | ||
thresholds: [], | ||
}, | ||
]); | ||
|
||
render(<Status query={query} viewport={VIEWPORT} />); | ||
|
||
expect(screen.queryByText(DATA_STREAM.unit)).not.toBeNull(); | ||
expect(screen.queryByText(LATEST_VALUE)).not.toBeNull(); | ||
}); |
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
23 changes: 23 additions & 0 deletions
23
packages/react-components/src/components/table/table.spec.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,23 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { mockTimeSeriesDataQuery } from '@iot-app-kit/testing-util'; | ||
import { DataStream } from '@iot-app-kit/core'; | ||
import { Table } from './table'; | ||
|
||
const VIEWPORT = { duration: '5m' }; | ||
|
||
const DATA_STREAM: DataStream = { id: 'abc-1', data: [], resolution: 0, name: 'my-name' }; | ||
|
||
it('renders', async () => { | ||
const query = mockTimeSeriesDataQuery([ | ||
{ | ||
dataStreams: [DATA_STREAM], | ||
viewport: VIEWPORT, | ||
thresholds: [], | ||
}, | ||
]); | ||
|
||
expect(() => { | ||
render(<Table columnDefinitions={[]} items={[]} queries={[query]} viewport={VIEWPORT} />); | ||
}).not.toThrowError(); | ||
}); |
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