Actually respect prettier configuration

This commit is contained in:
2024-02-03 20:23:31 -07:00
parent a6883a624a
commit 2276605e6d
37 changed files with 1629 additions and 1497 deletions

View File

@@ -1,38 +1,42 @@
import React from 'react';
import { render } from '@testing-library/react-native';
import React from "react";
import { render } from "@testing-library/react-native";
import "@testing-library/jest-native/extend-expect";
import ChartLabel from '../../component/charts/chart-label/chart-label';
import ChartLabel from "../../component/charts/chart-label/chart-label";
describe('ChartLabel Component Tests', () => {
const mockData = {
yLabels: [
{ displayName: 'Shots Taken', axis: 'LEFT' as 'LEFT', color: '#598EBB' },
{ displayName:'Make Percentage', axis: 'RIGHT' as 'RIGHT', color: '#F2D4BC'}
],
title: 'Shots Taken / Make Percentage by Cut Angle'
};
describe("ChartLabel Component Tests", () => {
const mockData = {
yLabels: [
{ displayName: "Shots Taken", axis: "LEFT" as "LEFT", color: "#598EBB" },
{
displayName: "Make Percentage",
axis: "RIGHT" as "RIGHT",
color: "#F2D4BC",
},
],
title: "Shots Taken / Make Percentage by Cut Angle",
};
it('should render the correct labels given yLabels', () => {
const { getByText } = render(
<ChartLabel title={mockData.title} yLabels={mockData.yLabels} />
);
it("should render the correct labels given yLabels", () => {
const { getByText } = render(
<ChartLabel title={mockData.title} yLabels={mockData.yLabels} />,
);
mockData.yLabels.forEach(label => {
expect(getByText(label.displayName)).toBeTruthy();
});
});
mockData.yLabels.forEach((label) => {
expect(getByText(label.displayName)).toBeTruthy();
});
});
it('should render the correct number of label boxes', () => {
const { getAllByText } = render(
<ChartLabel title={mockData.title} yLabels={mockData.yLabels} />
);
it("should render the correct number of label boxes", () => {
const { getAllByText } = render(
<ChartLabel title={mockData.title} yLabels={mockData.yLabels} />,
);
// Assuming displayName is unique and used only for labels
const labelElements = mockData.yLabels.map(label =>
getAllByText(label.displayName)
).flat();
// Assuming displayName is unique and used only for labels
const labelElements = mockData.yLabels
.map((label) => getAllByText(label.displayName))
.flat();
expect(labelElements.length).toBe(mockData.yLabels.length);
});
expect(labelElements.length).toBe(mockData.yLabels.length);
});
});