LiosK / uuidv7

A JavaScript implementation of UUID version 7
Apache License 2.0
177 stars 3 forks source link

Test case failing because of uuidv7 #5

Closed AyeshaAkram1 closed 1 year ago

AyeshaAkram1 commented 1 year ago

TypeError: (0 , _uuidv7.uuidv7) is not a function


      16 |           return (
    > 17 |             <Tag key={uuidv7()} color="blue">
         |                             ^
      18 |               {rule.operator === 'between'
      19 |                 ? `${rule.value && rule.value.split(',')[0]} - ${rule.value && rule.value.split(',')[1]}`
      20 |                 : rule.value}

following test case is failing due to uuidv7

it('it should render search result tags fine with between operator', async () => {
    const rule = { field: 'firstName', operator: 'between', value: 'Stev' };
    render(
      <Provider store={store(rule)}>
        <SearchResultTags />
      </Provider>
    );

    expect(screen.getByText('Stev - undefined')).toBeInTheDocument();
    expect(screen.getByText('Stev - undefined')).toHaveClass('ant-tag-blue');
  });
LiosK commented 1 year ago

I have absolutely no idea what's happening in this code.

AyeshaAkram1 commented 1 year ago

I have absolutely no idea what's happening in this code. there is an antd component named Tag (https://ant.design/components/tag) which is assigned a unique id using uuidv7 while testing it with react testing library with above test case it failed with the error

LiosK commented 1 year ago

Looks like the code failed to load uuidv7 library. I have no idea how to fix the issue.