From 2bd5566d6af4964fca73ef955209b186a7430e6b Mon Sep 17 00:00:00 2001 From: Jordan Date: Wed, 17 Jul 2024 06:55:41 -0700 Subject: [PATCH] add area rug test. merge with product as type. --- components/__tests__/AreaRugTag-test.tsx | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 components/__tests__/AreaRugTag-test.tsx diff --git a/components/__tests__/AreaRugTag-test.tsx b/components/__tests__/AreaRugTag-test.tsx new file mode 100644 index 0000000..3a1beb5 --- /dev/null +++ b/components/__tests__/AreaRugTag-test.tsx @@ -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( + + ); + + 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(); + }); +});