add area rug test. merge with product as type.

This commit is contained in:
Jordan 2024-07-17 06:55:41 -07:00
parent 49266bbc97
commit 2bd5566d6a

View File

@ -0,0 +1,29 @@
import React from 'react';
import { render, screen } from '@testing-library/react-native';
import { AreaRugTag } from '@/components/AreaRugTag';
import { area_t } from '@/lib/dimensions';
import dayjs from 'dayjs';
import { Area } from 'convert';
describe('AreaRugTag', () => {
it('renders correctly with dimensions, price per area, date and currency symbol', () => {
const dimensions: area_t = { l: 10, w: 20, u: 'foot' };
const pricePerArea = { price: 100, per: { n: 1, u: 'square foot' as Area } };
const date = dayjs();
const currencySymbol = '$';
render(
<AreaRugTag
dimensions={dimensions}
price_per_area={pricePerArea}
date={date}
currencySymbol={currencySymbol}
/>
);
expect(screen.getByText(`${dimensions.l} x ${dimensions.w}`)).toBeTruthy();
// expect(screen.getByLabelText('area rug price')).toContain(currencySymbol);
expect(screen.getByText(date.format('YYYY/MM/DD'))).toBeTruthy();
expect(screen.getByLabelText('this week\'s color')).toBeTruthy();
});
});