Atlas / Skills / tencentblueking / Unit Testing

Unit TestingSAFE

skills/tencentblueking/unit-testing

蓝鲸智云容器管理平台(BlueKing Container Service)

Verdict
SAFE
Grade
B
Trust score
89 /100
Version
—
Hosts
—
License
NOASSERTION
Stars
840
01

Overview

蓝鲸智云容器管理平台(BlueKing Container Service)

Read from source at commit 87a6fdb6f4b4OBSERVED · 2026-10-12
Advertisement
02

What it tells the agent

The instruction file, verbatim from the audited commit — this is the text the model reads, and the surface the audit's instruction layer examines. Quoted here so you can judge it without cloning anything.

---
id: qual-unit-test
name: Vue 3 组件单元测试指南 (Vitest)
category: quality
description: 使用 Vitest 和 Vue Test Utils 的标准模版与断言技巧
tags: [test, vitest, vue-test-utils, quality]
updated_at: 2026-01-09
---

# Vue 3 组件单元测试指南

采用 **Vitest** 作为测试运行器,配合 **@vue/test-utils** 进行组件测试。

## 环境准备

```json
"devDependencies": {
  "vitest": "^1.0.0",
  "@vue/test-utils": "^2.4.0",
  "jsdom": "^23.0.0"
}
```

## 测试模版

```typescript
import { mount } from '@vue/test-utils';
import { describe, it, expect, vi } from 'vitest';
import MyComponent from './MyComponent.vue';

describe('MyComponent.vue', () => {
  it('renders properly', () => {
    const wrapper = mount(MyComponent, {
      props: { title: 'Hello' }
    });
    expect(wrapper.text()).toContain('Hello');
  });

  it('emits event on click', async () => {
    const wrapper = mount(MyComponent);
    await wrapper.find('button').trigger('click');
    expect(wrapper.emitted()).toHaveProperty('submit');
  });
});
```

## 常用技巧

```typescript
// Mock 第三方组件
const wrapper = mount(MyComponent, {
  global: { stubs: { 'bk-table': true } }
});

// Mock API(文件顶部)
vi.mock('@/api/user', () => ({
  getUserInfo: vi.fn(() => Promise.resolve({ id: 1 }))
}));
```

## 运行测试

```bash
npm run test:unit
```

## 📦 按需加载资源

| 资源 | URI |
|-----|-----|
| 完整测试示例 | `skill://unit-testing/assets/component.spec.ts` |


---
## 📦 可用资源

- `skill://unit-testing/assets/component.spec.ts`

> 根据 SKILL.md 中的 IF-THEN 规则判断是否需要加载
03

Trust audit

SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.

LayerWhat it checksResult
L0Provenance & inventoryWARN
L1Static analysis of the codeNA
L2Instruction surface (what it tells the agent)PASS
L3Class-specific surfacePASS
L4Behavioural (sandbox)SKIPPED

What the source does

Filesystem
none-observed
Network
none-observed
Shell
none-observed
Dependencies
pinned
Secrets in source
none-found

Findings (1)

MEDIUMInventory / provenance · inv.symlink · CWE-1104
.codebuddy
.codebuddy
Why it matters. link not followed

Gates applied: no_behavioural_pass.

Audited 2026-10-12 · audit v0.4.1 · source sha 87a6fdb6f4b4full audit observations/trust-audit/skill/tencentblueking__unit-testing.json · Report an issue / request a re-scan
04

Audit history

Every audit this skill has had.

DateSourceVerdictGradeScoreChange
2026-10-1287a6fdb6f4b4SAFEB89first audit
05

Questions

What does the Unit Testing skill do?

蓝鲸智云容器管理平台(BlueKing Container Service)

Is Unit Testing safe to install?

The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.

What can Unit Testing access on my machine?

The audit observed no filesystem, network or shell use at all in its source.

How current is this page?

The grade is for one exact copy of the source (87a6fdb6f4b4), read on 2026-10-12. The repository is watched, and a new audit runs when it changes — this is the first audit.

Advertisement