Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: components unit test error #867

Merged
merged 2 commits into from
Jun 1, 2023
Merged

Conversation

GreenMashimaro
Copy link
Contributor

Fix package/components unit error

This repair does not change the original function logic, only adjusts the unit test file.

Why?

package/components execution yarn test unit test error

What?

cd ./packages/components
yarn test

Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
 FAIL  src/components/icon_button/icon_button.test.tsx (8.62 s)
  IconButton test
    ✓ The default is rounded and no background, size is small(24 * 24) (105 ms)
    ✓ When the size is large, it is rounded and the width and height are 32 * 32 (37 ms)
    ✓ Square when shape is square (19 ms)
    ✕ When variant is background, the background is gray (217 ms)

  ● IconButton test › When variant is background, the background is gray

    expect(received).toBe(expected) // Object.is equality

    Expected: "rgb(232, 234, 237)"
    Received: "rgb(224, 224, 224)"

      65 |     if (wrapperElement) {
      66 |       const styles = getComputedStyle(wrapperElement);
    > 67 |       expect(styles.background).toBe('rgb(232, 234, 237)');
         |                                 ^
      68 |     }
      69 |   });
      70 | });

      at Object.<anonymous> (src/components/icon_button/icon_button.test.tsx:67:33)

 FAIL  src/components/pagination/pagination.test.tsx
  ● Test suite failed to run

    src/components/pagination/pagination.stories.tsx:76:80 - error TS6133: 'page' is declared but its value is never read.

    76       <Pagination showChangeSize pageSize={size} total={71} onPageSizeChange={(page, pageSize) => { setSize(pageSize); }} />
                                                                                      ~~~~
    src/components/pagination/pagination.stories.tsx:92:28 - error TS6133: 'page' is declared but its value is never read.

    92         onPageSizeChange={(page, pageSize) => { setSize(pageSize); }}
                                  ~~~~
    src/components/pagination/pagination.stories.tsx:108:28 - error TS6133: 'page' is declared but its value is never read.

    108         onPageSizeChange={(page, pageSize) => { setSize(pageSize); }}
                                   ~~~~
    src/components/pagination/pagination.stories.tsx:125:28 - error TS6133: 'page' is declared but its value is never read.

    125         onPageSizeChange={(page, pageSize) => { setSize(pageSize); }}
                                   ~~~~

 FAIL  src/components/button/button.test.tsx (14.405 s)
  Button test
    ✓ Buttons support clicking by default (83 ms)
    ✓ Button disabled, clicking is invalid and the transparency is 0.5 (23 ms)
    ✓ Button support prefix icon (28 ms)
    ✓ Button support suffix icon (11 ms)
    ✓ Button support loading ui (13 ms)
    ✓ Button loading status disabled (11 ms)
    ✓ Button occupy 100% width (19 ms)
    ✕ Button default is solid button (11 ms)
    ✓ Button support Jelly button(light button) (13 ms)

  ● Button test › Button default is solid button

    expect(received).toBe(expected) // Object.is equality

    Expected: "rgb(249, 249, 255)"
    Received: "rgb(255, 255, 255)"

      102 |     const styles = getComputedStyle(buttonElement);
      103 |     const targetColor = convertHexToRGB(blackBlue[100]);
    > 104 |     expect(styles.color).toBe(targetColor);
          |                          ^
      105 |   });
      106 |
      107 |   it ('Button support Jelly button(light button)', () => {

      at Object.<anonymous> (src/components/button/button.test.tsx:104:26)

Test Suites: 3 failed, 3 total
Tests:       2 failed, 11 passed, 13 total
Snapshots:   0 total
Time:        16.626 s

The effect after repair

image

@CLAassistant
Copy link

CLAassistant commented May 26, 2023

CLA assistant check
All committers have signed the CLA.

@arucil arucil merged commit c2dcdc1 into apitable:develop Jun 1, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants