deaf-first-platform

«««< HEAD

Testing Documentation

This directory contains automated tests for the MBTQ Universe deaf-first platform APIs.

Test Structure

tests/
├── deafauth/           # DeafAUTH (Identity Cortex) tests
├── pinksync/           # PinkSync (Accessibility Engine) tests
├── fibonrose/          # Fibonrose (Trust & Blockchain) tests
├── magicians/          # 360Magicians (AI Agents) tests
├── dao/                # DAO (Governance) tests
└── openapi.test.js     # OpenAPI specification validation tests

Running Tests

Install Dependencies

npm install

Run All Tests

npm test

Run Tests with Coverage

npm run test:coverage

Run Tests in Watch Mode

npm run test:watch

Run Specific Service Tests

# DeafAUTH tests
npm test -- tests/deafauth

# PinkSync tests
npm test -- tests/pinksync

# 360Magicians tests
npm test -- tests/magicians

# Fibonrose tests
npm test -- tests/fibonrose

# DAO tests
npm test -- tests/dao

# OpenAPI validation tests
npm test -- tests/openapi.test.js

Test Coverage

The test suite covers:

DeafAUTH (Identity Cortex)

PinkSync (Accessibility Engine)

Fibonrose (Trust & Blockchain)

360Magicians (AI Agent Platform)

DAO (Governance)

OpenAPI Specifications

Test Framework

Writing New Tests

Follow the existing test patterns:

describe('Service Name API', () => {
  const baseURL = 'https://api.mbtquniverse.com/service';
  const authToken = 'Bearer valid_token';

  beforeEach(() => {
    jest.clearAllMocks();
  });

  describe('GET /endpoint', () => {
    it('should perform expected action', async () => {
      // Mock response
      const mockResponse = {
        data: { /* expected data */ }
      };

      axios.get.mockResolvedValue(mockResponse);

      // Make request
      const response = await axios.get(`${baseURL}/endpoint`, {
        headers: { Authorization: authToken }
      });

      // Assertions
      expect(response.data).toHaveProperty('expectedField');
    });
  });
});

Continuous Integration

These tests are designed to run in CI/CD pipelines:

# Example GitHub Actions workflow
- name: Run tests
  run: npm test

- name: Generate coverage
  run: npm run test:coverage

Best Practices

  1. Mock External Dependencies: All HTTP requests are mocked
  2. Test Error Scenarios: Include negative test cases
  3. Clear Assertions: Use descriptive expect statements
  4. Cleanup: Use beforeEach to reset mocks
  5. Descriptive Names: Use clear test descriptions

Integration with OpenAPI

The tests are designed to match the OpenAPI specifications in services/*/openapi/openapi.yaml. When the specs change, update the corresponding tests.

Validation Scripts

Validate OpenAPI Specs

npm run validate:openapi

This validates all OpenAPI specifications for:

SDK Generation

Generate SDKs from OpenAPI specs:

# Generate TypeScript SDK
npm run generate:sdk:typescript

# Generate Python SDK
npm run generate:sdk:python

# Generate all SDKs
npm run generate:sdk

Generated SDKs will be in the sdks/ directory.

Testing Documentation

This directory contains automated tests for the MBTQ Universe deaf-first platform APIs.

Test Structure

tests/
├── deafauth/           # DeafAUTH (Identity Cortex) tests
├── pinksync/           # PinkSync (Accessibility Engine) tests
├── fibonrose/          # Fibonrose (Trust & Blockchain) tests
├── magicians/          # 360Magicians (AI Agents) tests
├── dao/                # DAO (Governance) tests
└── openapi.test.js     # OpenAPI specification validation tests

Running Tests

Install Dependencies

npm install

Run All Tests

npm test

Run Tests with Coverage

npm run test:coverage

Run Tests in Watch Mode

npm run test:watch

Run Specific Service Tests

# DeafAUTH tests
npm test -- tests/deafauth

# PinkSync tests
npm test -- tests/pinksync

# 360Magicians tests
npm test -- tests/magicians

# Fibonrose tests
npm test -- tests/fibonrose

# DAO tests
npm test -- tests/dao

# OpenAPI validation tests
npm test -- tests/openapi.test.js

Test Coverage

The test suite covers:

DeafAUTH (Identity Cortex)

PinkSync (Accessibility Engine)

Fibonrose (Trust & Blockchain)

360Magicians (AI Agent Platform)

DAO (Governance)

OpenAPI Specifications

Test Framework

Writing New Tests

Follow the existing test patterns:

describe('Service Name API', () => {
  const baseURL = 'https://api.mbtquniverse.com/service';
  const authToken = 'Bearer valid_token';

  beforeEach(() => {
    jest.clearAllMocks();
  });

  describe('GET /endpoint', () => {
    it('should perform expected action', async () => {
      // Mock response
      const mockResponse = {
        data: { /* expected data */ }
      };

      axios.get.mockResolvedValue(mockResponse);

      // Make request
      const response = await axios.get(`${baseURL}/endpoint`, {
        headers: { Authorization: authToken }
      });

      // Assertions
      expect(response.data).toHaveProperty('expectedField');
    });
  });
});

Continuous Integration

These tests are designed to run in CI/CD pipelines:

# Example GitHub Actions workflow
- name: Run tests
  run: npm test

- name: Generate coverage
  run: npm run test:coverage

Best Practices

  1. Mock External Dependencies: All HTTP requests are mocked
  2. Test Error Scenarios: Include negative test cases
  3. Clear Assertions: Use descriptive expect statements
  4. Cleanup: Use beforeEach to reset mocks
  5. Descriptive Names: Use clear test descriptions

Integration with OpenAPI

The tests are designed to match the OpenAPI specifications in services/*/openapi/openapi.yaml. When the specs change, update the corresponding tests.

Validation Scripts

Validate OpenAPI Specs

npm run validate:openapi

This validates all OpenAPI specifications for:

SDK Generation

Generate SDKs from OpenAPI specs:

# Generate TypeScript SDK
npm run generate:sdk:typescript

# Generate Python SDK
npm run generate:sdk:python

# Generate all SDKs
npm run generate:sdk

Generated SDKs will be in the sdks/ directory.

e961430… Add Node.js API automated tests and SDK generation capabilities