-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase test coverage #150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
src/appendFrames.test.ts
Outdated
expect(appendMatchingFrames([], [])).toEqual([]); | ||
}); | ||
|
||
it('should return input MutableDataFrames', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kind of a nit that we can ignore if we don't have good ideas for it:
- in reading this test and the one below I'm not sure I really understand the difference between these two tests. I wonder if we can update the "it" statements to better describe what we're handling or something. Or if these some data frames are mutable should we change them and see that append still handles them the same or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about :
it('should return input MutableDataFrames', () => { | |
it('should return input when input is a MutableDataFrames array, () => { |
and next suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good to me
src/appendFrames.ts
Outdated
@@ -58,6 +58,8 @@ export function appendMatchingFrames(prev: DataFrame[], b: DataFrame[]): DataFra | |||
for (let i = 0; i < f.length; i++) { | |||
for (let idx = 0; idx < old.fields.length; idx++) { | |||
old.fields[idx].values.add(f.fields[idx].values.get(i)); | |||
// FIXME: I assume this is meant to modify `out` but it's | |||
// not doing anything atm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol should we make a ticket or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double checking this it actually works 🤯
I assume that old.fields[idx]
is pointing to the same vector reference than out
so modifying that modifies the result. I have added a test that covers this.
src/appendFrames.test.ts
Outdated
expect(appendMatchingFrames([frame], [])).toEqual([frame]); | ||
}); | ||
|
||
it('should return input DataFrame', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('should return input DataFrame', () => { | |
it('should return a MutableDataFrame version of input when input is a DataFrames array', () => { |
|
||
it('should append new frames', () => { | ||
const frame = new MutableDataFrame({ fields: [{ name: 'foo', values: v }] }); | ||
expect(appendMatchingFrames([], [frame])).toEqual([frame]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a test for two not empty arrays?
Not sure the following works ;)
expect(appendMatchingFrames([], [frame])).toEqual([frame]); | |
expect(appendMatchingFrames([frame], [frame])).toEqual([frame, frame]); |
|
||
import { DataSource } from '../DataSource'; | ||
import { TimestreamOptions, TimestreamQuery } from '../types'; | ||
|
||
export type Props = MetadataInspectorProps<DataSource, TimestreamQuery, TimestreamOptions>; | ||
|
||
export class MetaInspector extends PureComponent<Props> { | ||
state = { index: 0 }; | ||
export function MetaInspector(props: Props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Fixes #149
appendFrames
(and discovered a potential bug?)MetadataInspector
(and migrated to a function component)Forms
The coverage is now 47% which is not great but at least covers the 40% level that we wanted: