Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

1.0 KB
Raw Blame
import { describe, it, expect } from 'vitest';
import { withRetry } from '../src/production/retry.js';
describe('production retry rejection values', () => {
  it.each(['network reset', null, 42])(
    'returns failed retry evidence for %s',
    async (value) => {
      const result = await withRetry(
        async () => {
          throw value;
        },
        { maxAttempts: 2, initialDelayMs: 0, jitter: 0 },
      );
      expect(result.success).toBe(false);
      expect(result.attempts).toBe(2);
      expect(result.error).toBeInstanceOf(Error);
      expect(result.error!.message).toBe(String(value));
      expect(result.retryHistory[0].error).toBe(String(value));
    },
  );
  it('retains Error identity and nonretryable classification', async () => {
    const error = new Error('authentication denied');
    const result = await withRetry(
      async () => {
        throw error;
      },
      { maxAttempts: 2, initialDelayMs: 0 },
    );
    expect(result.attempts).toBe(1);
    expect(result.error).toBe(error);
  });
});