← スキル一覧に戻る
Use
Why

testing-guidelines
by vjcspy
⭐ 0🍴 0📅 2026年1月25日
SKILL.md
name: testing-guidelines description: TinyBots testing best practices and assertion patterns for writing integration tests
TinyBots Testing Guidelines
When writing tests for TinyBots repositories, follow these guidelines for consistent, maintainable test code.
Assertion Best Practices
Use deep.include for Object Assertions
Prefer expect(obj).to.deep.include({...}) over checking individual fields one by one. This provides a balance between conciseness and flexibility.
// ❌ Avoid: Verbose individual field checks
expect(res.body.id).to.equal(scheduledExecutionId)
expect(res.body.executionType).to.equal('scheduled')
expect(res.body.executedAt).to.equal(plannedIso)
expect(res.body.schedule.scheduleId).to.equal(880011)
// ✅ Prefer: deep.include for partial matching
expect(res.body).to.deep.include({
id: scheduledExecutionId,
executionType: 'scheduled',
executedAt: plannedIso,
schedule: { scheduleId: 880011 }
})
Why deep.include over deep.equal
| Benefit | Description |
|---|---|
| Ignores dynamic fields | Doesn't fail on createdAt, updatedAt, etc. |
| Less brittle | Won't break if new fields are added to the response |
| Validates structure | Still validates nested object structure correctly |
When to Use Individual Checks
Use separate assertions when you need:
- Array length checks: Verify collection sizes
- Type checks: Confirm data types explicitly
- Specific error messages: Need custom failure messages for specific fields
// Combine deep.include with specific checks
expect(res.body).to.deep.include({ id: expectedId, status: 'active' })
expect(res.body.items).to.be.an('array').with.lengthOf(3)
Test Structure
Arrange-Act-Assert Pattern
it('should return execution details', async () => {
// Arrange - setup test data
const executionId = await createTestExecution()
// Act - perform the action
const res = await request(app)
.get(`/v6/scripts/user/robots/1/executions/${executionId}`)
.set('x-authenticated-userid', '1')
// Assert - verify results
expect(res.status).to.equal(200)
expect(res.body).to.deep.include({
id: executionId,
executionType: 'triggered'
})
})
Descriptive Test Names
- Use
shouldprefix for clarity - Describe the expected behavior, not the implementation
- Include relevant context (e.g., "when user is not authenticated")
// ✅ Good
it('should return 404 when execution does not exist')
it('should return paginated results when limit is specified')
// ❌ Avoid
it('test execution endpoint')
it('works correctly')
Running Tests
IMPORTANT: All TinyBots tests must run inside Docker containers via
justcommands. Seedevdocs/agent/rules/tinybots/run-tests.mdfor execution instructions.
# Run tests for a specific repository
just -f devtools/tinybots/local/Justfile test-<repo>
スコア
総合スコア
40/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です