← Back to list

write-test
by useautumn
Autumn is an open-source pricing & billing platform
⭐ 2,309🍴 178📅 Jan 22, 2026
Use Cases
⚡
Work Efficiency
Streamline daily tasks and improve productivity.
📋
Project Management
Assist with task management and project tracking.
👥
Team Collaboration
Improve team communication and collaboration.
SKILL.md
name: write-test description: Write integration tests for the Autumn billing system. Use when creating tests, writing test scenarios for billing/subscription features, track/check endpoints, or when the user asks about testing, test cases, or QA. license: Proprietary metadata: author: autumn version: "1.0"
What I do
Write integration tests for the Autumn billing system using the initScenario pattern.
Before Writing Any Test
ALWAYS read these codebase files FIRST:
server/tests/TEST_GUIDE.md- Core patterns, fixtures, scenario builder- For billing tests:
server/tests/integration/billing/update-subscription/BILLING_GUIDE.md
Critical Rules
DO:
- Use
test.concurrent()for isolated, parallel tests - Use
initScenariowiths.*builders - Use
product.idins.attach()(never string literals) - Use
Decimal.jsfor balance calculations in track tests - Unique
customerIdper test
DON'T:
- Use
describe/beforeAll/test(legacy pattern) - Use
Date.now()with test clocks (useadvancedTo) - Share state between tests
- Use raw arithmetic for balance calculations (floating point errors)
Minimal Template
import { expect, test } from "bun:test";
import { type ApiCustomerV3 } from "@autumn/shared";
import { expectCustomerFeatureCorrect } from "@tests/integration/billing/utils/expectCustomerFeatureCorrect";
import { TestFeature } from "@tests/setup/v2Features.js";
import { items } from "@tests/utils/fixtures/items.js";
import { products } from "@tests/utils/fixtures/products.js";
import { initScenario, s } from "@tests/utils/testInitUtils/initScenario.js";
import chalk from "chalk";
test.concurrent(`${chalk.yellowBright("feature: description")}`, async () => {
const messagesItem = items.monthlyMessages({ includedUsage: 100 });
const pro = products.base({ id: "pro", items: [messagesItem] });
const { customerId, autumnV1 } = await initScenario({
customerId: "unique-test-id",
setup: [s.customer({ paymentMethod: "success" }), s.products({ list: [pro] })],
actions: [s.attach({ productId: pro.id })],
});
const customer = await autumnV1.customers.get<ApiCustomerV3>(customerId);
expectCustomerFeatureCorrect({ customer, featureId: TestFeature.Messages, balance: 100 });
});
References
Load these on-demand for detailed information:
- references/SCENARIO.md - Scenario initialization, product configs,
s.*builders - references/FIXTURES.md - Item and product fixtures with all params
- references/ENTITIES.md - Entity-based testing (multi-tenant, per-entity billing)
- references/TRACK-CHECK.md - Track/check endpoint testing, credit systems, Decimal.js
- references/EXPECTATIONS.md - All expectation utilities
- references/GOTCHAS.md - Common pitfalls, debugging, billing edge cases
File Location
Tests: server/tests/integration/billing/ organized by feature area.
Run Tests
bun test path/to/file.test.ts
Score
Total Score
80/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
✓人気
GitHub Stars 1000以上
+15
✓最近の活動
3ヶ月以内に更新
+5
✓フォーク
10回以上フォークされている
+5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon