test-resource-service

Automate CRUD tests for resource services with authorization and event emission.

1|Updated May 21, 2025
One-click install
npx skills add https://github.com/madooei/backend-template --skill test-resource-service
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-resource-service
Source: https://github.com/madooei/backend-template/tree/main/.claude/skills/test-resource-service
Command: npx skills add https://github.com/madooei/backend-template --skill test-resource-service

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured template for testing resource services that implement BaseService-like authorization and event emission, reducing boilerplate and ensuring consistent test coverage.

Core Features & Use Cases

  • Comprehensive CRUD test coverage (create, read, update, delete) with ownership and admin roles.
  • Event emission verification for created/updated/deleted operations.
  • Integration-style testing using a MockDB repository and shared test utilities.

Quick Start

Run the test suite to validate authorization rules and event emissions for your resource services.

Frequently Asked Questions about test-resource-service

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test resource service CRUD operations with authorization and event emission?

To test resource service CRUD operations with authorization and event emission, you can use a structured template that automates validation of admin and owner permissions alongside emitted event payloads using vitest and a MockDB repository.

What is the best way to verify admin and owner permissions in a BaseService test suite?

The best way to verify admin and owner permissions in a BaseService test suite is by applying automated CRUD tests that validate access controls against a MockDB repository, ensuring both admin and owner roles behave correctly.

Can I use vitest to validate event payloads created by resource services?

Yes, you can use vitest to validate event payloads created by resource services. The testing template uses an event emitter to verify that created, updated, and deleted operations emit the correct events.

Do I need a MockDB repository to test resource service authorization rules?

Yes, you need a MockDB repository to test resource service authorization rules. The integration-style testing template relies on a MockDB repository and an event emitter to validate access controls and event payloads.

How does event emission verification work for resource service CRUD operations?

Event emission verification works by using an event emitter during CRUD test execution to capture and assert the payloads emitted during created, updated, and deleted operations, ensuring the service emits the correct events.

What does a resource service test template cover for BaseService implementations?

A resource service test template for BaseService implementations covers comprehensive CRUD operations, admin and ownership authorization validation, and event emission verification to reduce boilerplate and ensure consistent test coverage.