write-tests — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited write-tests (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
You are tasked with creating comprehensive unit tests for the following file(s): $ARGUMENTS
bun test)tests folder bun test --coverageDocument the current coverage percentage for the file(s).
[workspace]/tests/[relative-path-to-source]/[filename].test.ts(x).test.ts for .ts files and .test.tsx for .tsx filesimport { describe, test, expect, beforeEach, afterEach, mock } from "bun:test";
// Import the module/component to test
import { /* items to test */ } from "../path/to/source/file";
describe("[ModuleName/ComponentName]", () => {
// Setup and teardown if needed
beforeEach(() => {
// Reset mocks, initialize test data
});
afterEach(() => {
// Cleanup
});
describe("[FunctionName/MethodName]", () => {
test("should [expected behavior] when [condition]", () => {
// Arrange
// Act
// Assert
});
test("should handle [edge case]", () => {
// Test edge cases
});
test("should throw error when [invalid condition]", () => {
// Test error scenarios
});
});
});#### For All Files
#### For React Components (.tsx)
#### For Utility Functions (.ts)
// Mock external modules
mock.module("../api/client", () => ({
fetchData: mock(() => Promise.resolve({ data: "mocked" }))
}));
// Mock timers if needed
import { useFakeTimers } from "bun:test";#### Data Validation
#### State Management
#### Error Handling
bun test [test-file-path] bun test --coverageProvide:
// tests/components/UserProfile.test.tsx
import { describe, test, expect, mock } from "bun:test";
import { render, screen, fireEvent } from "@testing-library/react";
import { UserProfile } from "../../src/components/UserProfile";
import { userService } from "../../src/services/userService";
// Mock the service
mock.module("../../src/services/userService", () => ({
userService: {
getUser: mock(),
updateUser: mock()
}
}));
describe("UserProfile", () => {
const mockUser = {
id: "123",
name: "John Doe",
email: "[email protected]"
};
beforeEach(() => {
mock.restore();
});
describe("rendering", () => {
test("should display user information when data is loaded", async () => {
userService.getUser.mockResolvedValue(mockUser);
render(<UserProfile userId="123" />);
expect(await screen.findByText("John Doe")).toBeInTheDocument();
expect(screen.getByText("[email protected]")).toBeInTheDocument();
});
test("should show loading state initially", () => {
userService.getUser.mockResolvedValue(mockUser);
render(<UserProfile userId="123" />);
expect(screen.getByText("Loading...")).toBeInTheDocument();
});
test("should display error message when user fetch fails", async () => {
userService.getUser.mockRejectedValue(new Error("Network error"));
render(<UserProfile userId="123" />);
expect(await screen.findByText(/error/i)).toBeInTheDocument();
});
});
describe("interactions", () => {
test("should call updateUser when save button is clicked", async () => {
userService.getUser.mockResolvedValue(mockUser);
userService.updateUser.mockResolvedValue({ ...mockUser, name: "Jane Doe" });
render(<UserProfile userId="123" />);
const input = await screen.findByLabelText("Name");
fireEvent.change(input, { target: { value: "Jane Doe" } });
const saveButton = screen.getByRole("button", { name: "Save" });
fireEvent.click(saveButton);
expect(userService.updateUser).toHaveBeenCalledWith("123", {
name: "Jane Doe"
});
});
});
});Remember to think critically about what the code SHOULD do, not just what it currently does. Consider the function/component names, parameters, return types, and any documentation to infer the intended behavior.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.