Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
iwysiu committed Dec 12, 2024
1 parent b1ab685 commit 5cfdfac
Show file tree
Hide file tree
Showing 5 changed files with 1,582 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .config/jest/mocks/react-inlinesvg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export const cacheStore: { [key: string]: StorageItem } = Object.create(null);

const SVG_FILE_NAME_REGEX = /(.+)\/(.+)\.svg$/;

const InlineSVG = ({ src }: { src: string }) => {
const InlineSVG = ({ src, innerRef, ...rest }: { src: string; innerRef: React.ForwardedRef<SVGElement> }) => {
// testId will be the file name without extension (e.g. `public/img/icons/angle-double-down.svg` -> `angle-double-down`)
const testId = src.replace(SVG_FILE_NAME_REGEX, '$2');
return <svg xmlns="http://www.w3.org/2000/svg" data-testid={testId} viewBox="0 0 24 24" />;
return <svg xmlns="http://www.w3.org/2000/svg" data-testid={testId} {...rest} viewBox="0 0 24 24" />;
};

export default InlineSVG;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@grafana/ui": "^11.4.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "^7.0.2",
"tslib": "2.8.1",
"@emotion/css": "11.10.6"
},
Expand Down
6 changes: 3 additions & 3 deletions src/appendFrames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export function appendMatchingFrames(prev: DataFrame[], b: DataFrame[]): DataFra
for (const field of f.fields) {
const buffer: any[] = [];
for (let i = 0; i < f.length; i++) {
buffer.push(field.values.get(i));
buffer.push(field.values[i]);
}
frame.addField({
...field,
values: [buffer],
values: buffer,
});
}

Expand All @@ -57,7 +57,7 @@ export function appendMatchingFrames(prev: DataFrame[], b: DataFrame[]): DataFra
if (old) {
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));
old.fields[idx].values.push(f.fields[idx].values[i]);
}
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/dataFrameUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function trimTimeSeriesDataFrame({

const trimmedFields = fields.map((field) => ({
...field,
values: [field.values.toArray().slice(fromIndex, toIndex)],
values: field.values.toArray().slice(fromIndex, toIndex),
}));

return {
Expand Down Expand Up @@ -114,7 +114,7 @@ export function trimTimeSeriesDataFrameReversedTime({

return {
...field,
values: [dataValues.reverse()],
values: dataValues.reverse(),
};
});

Expand Down
Loading

0 comments on commit 5cfdfac

Please sign in to comment.