补齐测试配置与上传资源

This commit is contained in:
baiyanyun
2026-06-29 20:02:05 +08:00
parent f84dc1d44e
commit 91f68576dd
13 changed files with 98 additions and 10 deletions

View File

@@ -0,0 +1,9 @@
---
name:
description:
license:
---
# Processing Guide
## Overview

View File

@@ -0,0 +1,4 @@
{
"description": "Skill template",
"config": {}
}

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env python3
# Helper script for this skill
if __name__ == "__main__":
print("Process script placeholder")

View File

@@ -0,0 +1,3 @@
# API Documentation
Add interface descriptions related to skills here.

View File

@@ -104,6 +104,10 @@
<groupId>com.xspaceagi</groupId> <groupId>com.xspaceagi</groupId>
<artifactId>app-platform-bill-web</artifactId> <artifactId>app-platform-bill-web</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies> </dependencies>
<profiles> <profiles>
<profile> <profile>

View File

@@ -33,7 +33,8 @@
"serve": "http-server ./dist", "serve": "http-server ./dist",
"setup": "max setup", "setup": "max setup",
"start": "npm run dev", "start": "npm run dev",
"test": "vitest", "test": "vitest run",
"test:watch": "vitest",
"verify-commit": "max verify-commit" "verify-commit": "max verify-commit"
}, },
"lint-staged": { "lint-staged": {
@@ -140,14 +141,15 @@
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"esbuild": "^0.27.0", "esbuild": "^0.27.0",
"husky": "^9.1.7", "husky": "^9.1.7",
"jsdom": "^27.3.0", "jest-axe": "^10.0.0",
"jsdom": "^22.1.0",
"lint-staged": "^13.2.0", "lint-staged": "^13.2.0",
"prettier": "^2.8.7", "prettier": "^2.8.7",
"prettier-plugin-organize-imports": "^3.2.2", "prettier-plugin-organize-imports": "^3.2.2",
"prettier-plugin-packagejson": "^2.4.3", "prettier-plugin-packagejson": "^2.4.3",
"standard-version": "^9.5.0", "standard-version": "^9.5.0",
"typescript": "^5.0.3", "typescript": "^5.0.3",
"vitest": "^4.0.15" "vitest": "^0.34.6"
}, },
"packageManager": "pnpm@10.27.0", "packageManager": "pnpm@10.27.0",
"engines": { "engines": {

View File

@@ -1,17 +1,25 @@
/** /**
* Axe smoke coverage for low-level shared UI components. * Axe smoke coverage for low-level shared UI components.
*/ */
import { import ActionMenu from '@/components/base/ActionMenu';
ActionMenu, import CopyButton from '@/components/base/CopyButton';
CopyButton, import CopyIconButton from '@/components/base/CopyIconButton';
CopyIconButton, import MenuListItem from '@/components/base/MenuListItem';
MenuListItem, import SecondMenuItem from '@/components/base/SecondMenuItem';
SecondMenuItem,
} from '@/components/base';
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import { axe } from 'jest-axe'; import { axe } from 'jest-axe';
import { describe, expect, it, vi } from 'vitest'; import { describe, expect, it, vi } from 'vitest';
vi.mock('@/components/base/SvgIcon', () => ({
default: ({ name }: { name: string }) => (
<span aria-hidden="true" data-icon={name} />
),
}));
vi.mock('@/services/i18nRuntime', () => ({
dict: (key: string) => key,
}));
const assertNoViolations = async (element: HTMLElement) => { const assertNoViolations = async (element: HTMLElement) => {
const results = await axe(element); const results = await axe(element);
expect(results.violations).toEqual([]); expect(results.violations).toEqual([]);

View File

@@ -1,4 +1,52 @@
import '@testing-library/jest-dom'; import '@testing-library/jest-dom';
import { TextDecoder, TextEncoder } from 'node:util';
Object.assign(globalThis, { TextDecoder, TextEncoder });
if (typeof window !== 'undefined') {
Object.assign(window, { TextDecoder, TextEncoder });
}
class MemoryStorage implements Storage {
private readonly store = new Map<string, string>();
get length() {
return this.store.size;
}
clear() {
this.store.clear();
}
getItem(key: string) {
return this.store.get(key) ?? null;
}
key(index: number) {
return Array.from(this.store.keys())[index] ?? null;
}
removeItem(key: string) {
this.store.delete(key);
}
setItem(key: string, value: string) {
this.store.set(key, String(value));
}
}
const ensureStorage = (name: 'localStorage' | 'sessionStorage') => {
const current = globalThis[name];
if (current) return;
Object.defineProperty(globalThis, name, {
configurable: true,
value: new MemoryStorage(),
});
};
ensureStorage('localStorage');
ensureStorage('sessionStorage');
// antd 响应式依赖 matchMedia测试环境补齐 // antd 响应式依赖 matchMedia测试环境补齐
if (typeof window !== 'undefined' && !window.matchMedia) { if (typeof window !== 'undefined' && !window.matchMedia) {

View File

@@ -11,6 +11,11 @@ export default defineConfig({
test: { test: {
globals: true, globals: true,
environment: 'jsdom', environment: 'jsdom',
environmentOptions: {
jsdom: {
url: 'http://localhost/',
},
},
setupFiles: './tests/setupTests.ts', setupFiles: './tests/setupTests.ts',
exclude: [...configDefaults.exclude, 'tests/**/*[Vv]2*.test.{ts,tsx}'], exclude: [...configDefaults.exclude, 'tests/**/*[Vv]2*.test.{ts,tsx}'],
alias: { alias: {

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB