add-knowledge-connector-unit-tests

Create unit tests for Cognigy Knowledge Connectors using Node.js test runner and mocks.

30|60|Updated Jul 30, 2020
One-click install
npx skills add https://github.com/Cognigy/Extensions --skill add-knowledge-connector-unit-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-knowledge-connector-unit-tests
Source: https://github.com/Cognigy/Extensions/tree/main/.claude/skills/add-knowledge-connector-unit-tests
Command: npx skills add https://github.com/Cognigy/Extensions --skill add-knowledge-connector-unit-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach to creating and validating unit tests for Cognigy Knowledge Connector extensions, reducing setup time and ensuring consistent testing practices across projects.

Core Features & Use Cases

  • Provides a complete blueprint for test scaffolding using Node.js built-in test runner with node:test and node:assert.
  • Includes guidelines for creating mock KnowledgeApi interactions and vendor API responses.
  • Demonstrates how to structure tests for create, upsert, and delete Knowledge Sources and Chunks, and how to verify outcomes with assertions.

Quick Start

Install dependencies, implement a connector test following the template, and run npm test to execute the suite.

Frequently Asked Questions about add-knowledge-connector-unit-tests

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

FAQPage Schema
How do I write unit tests for Cognigy Knowledge Connectors?

To write unit tests for Cognigy Knowledge Connectors, you use the Node.js built-in test runner alongside standardized KnowledgeApi mocks to validate data flows without hitting live external vendor APIs.

What's the best way to mock vendor API responses in a TypeScript connector test?

The best way to mock vendor API responses in TypeScript connector tests is to implement standardized mock patterns that intercept vendor calls and assert KnowledgeApi interactions for create, upsert, and delete operations.

Do I need external testing frameworks to test Cognigy extension connectors?

You do not need external testing frameworks to test Cognigy extension connectors; the approach uses the Node.js built-in test runner with node:test and node:assert for complete test scaffolding and assertion verification.

How do I verify create, upsert, and delete operations in a Knowledge Source test?

To verify create, upsert, and delete operations in a Knowledge Source test, you structure test scenarios against mock KnowledgeApi interactions and use node:assert assertions to confirm the expected data outcomes for Chunks and Sources.

Can I use this testing template for non-TypeScript knowledge connectors?

This testing template targets TypeScript integration specifically, providing standardized mock patterns and type-safe test scaffolding designed for the Node.js environment required by Cognigy extension development.

Why are my Knowledge Connector unit tests failing to validate upsert flows?

Knowledge Connector unit tests fail to validate upsert flows when the KnowledgeApi mock patterns are not standardized, preventing proper verification of the create and update operations handled by the test scaffolding.