File size: 2,931 Bytes
64011fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { describe, it, expect } from 'vitest';
import {
  singlePdfLoadTools,
  simpleTools,
  multiFileTools,
} from '@/js/config/pdf-tools';

describe('Tool Configuration Arrays', () => {
  // --- Tests for singlePdfLoadTools ---
  describe('singlePdfLoadTools', () => {
    it('should be an array of non-empty strings', () => {
      expect(Array.isArray(singlePdfLoadTools)).toBe(true);
      expect(singlePdfLoadTools.length).toBeGreaterThan(0);
      for (const tool of singlePdfLoadTools) {
        expect(typeof tool).toBe('string');
        expect(tool.length).toBeGreaterThan(0);
      }
    });

    it('should have the correct number of tools', () => {
      // This acts as a snapshot test to catch unexpected additions/removals.
      expect(singlePdfLoadTools).toHaveLength(41);
    });

    it('should not contain any duplicate tools', () => {
      const uniqueTools = new Set(singlePdfLoadTools);
      expect(uniqueTools.size).toBe(singlePdfLoadTools.length);
    });
  });

  // --- Tests for simpleTools ---
  describe('simpleTools', () => {
    it('should be an array of non-empty strings', () => {
      expect(Array.isArray(simpleTools)).toBe(true);
      expect(simpleTools.length).toBeGreaterThan(0);
      simpleTools.forEach((tool) => {
        expect(typeof tool).toBe('string');
        expect(tool.length).toBeGreaterThan(0);
      });
    });

    it('should have the correct number of tools', () => {
      expect(simpleTools).toHaveLength(5);
    });

    it('should not contain any duplicate tools', () => {
      const uniqueTools = new Set(simpleTools);
      expect(uniqueTools.size).toBe(simpleTools.length);
    });
  });

  // --- Tests for multiFileTools ---
  describe('multiFileTools', () => {
    it('should be an array of non-empty strings', () => {
      expect(Array.isArray(multiFileTools)).toBe(true);
      expect(multiFileTools.length).toBeGreaterThan(0);
      multiFileTools.forEach((tool) => {
        expect(typeof tool).toBe('string');
        expect(tool.length).toBeGreaterThan(0);
      });
    });

    it('should have the correct number of tools', () => {
      expect(multiFileTools).toHaveLength(13);
    });

    it('should not contain any duplicate tools', () => {
      const uniqueTools = new Set(multiFileTools);
      expect(uniqueTools.size).toBe(multiFileTools.length);
    });
  });

  // --- Cross-Category Uniqueness Test ---
  describe('Uniqueness Across All Tool Categories', () => {
    it('should ensure no tool exists in more than one category', () => {
      const allTools = [
        ...singlePdfLoadTools,
        ...simpleTools,
        ...multiFileTools,
      ];
      const uniqueTools = new Set(allTools);

      // If the size of the Set is different from the length of the combined array,
      // it means there was at least one duplicate tool across the categories.
      expect(uniqueTools.size).toBe(allTools.length);
    });
  });
});