mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 19:39:25 +08:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user