chore: add some jest tests (#29800)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
yyh
2025-12-18 10:00:11 +08:00
committed by GitHub
parent c474177a16
commit 9812dc2cb2
17 changed files with 2364 additions and 46 deletions

View File

@@ -1,11 +1,9 @@
import { render, screen } from '@testing-library/react'
import AnnotationFull from './index'
let mockUsageProps: { className?: string } | null = null
jest.mock('./usage', () => ({
__esModule: true,
default: (props: { className?: string }) => {
mockUsageProps = props
return (
<div data-testid='usage-component' data-classname={props.className ?? ''}>
usage
@@ -14,11 +12,9 @@ jest.mock('./usage', () => ({
},
}))
let mockUpgradeBtnProps: { loc?: string } | null = null
jest.mock('../upgrade-btn', () => ({
__esModule: true,
default: (props: { loc?: string }) => {
mockUpgradeBtnProps = props
return (
<button type='button' data-testid='upgrade-btn'>
{props.loc}
@@ -30,8 +26,6 @@ jest.mock('../upgrade-btn', () => ({
describe('AnnotationFull', () => {
beforeEach(() => {
jest.clearAllMocks()
mockUsageProps = null
mockUpgradeBtnProps = null
})
// Rendering marketing copy with action button

View File

@@ -1,11 +1,9 @@
import { fireEvent, render, screen } from '@testing-library/react'
import AnnotationFullModal from './modal'
let mockUsageProps: { className?: string } | null = null
jest.mock('./usage', () => ({
__esModule: true,
default: (props: { className?: string }) => {
mockUsageProps = props
return (
<div data-testid='usage-component' data-classname={props.className ?? ''}>
usage
@@ -59,7 +57,6 @@ jest.mock('../../base/modal', () => ({
describe('AnnotationFullModal', () => {
beforeEach(() => {
jest.clearAllMocks()
mockUsageProps = null
mockUpgradeBtnProps = null
mockModalProps = null
})