crowi.integ.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Integration test to verify Crowi setup works correctly in Vitest environment.
  3. * This ensures the test/setup/crowi.ts utility functions properly.
  4. */
  5. import type Crowi from '~/server/crowi';
  6. import { getInstance, resetInstance } from './crowi';
  7. describe('Crowi Setup for Integration Tests', () => {
  8. let crowi: Crowi;
  9. beforeAll(async () => {
  10. resetInstance();
  11. crowi = await getInstance();
  12. });
  13. it('should create a Crowi instance', () => {
  14. expect(crowi).toBeDefined();
  15. expect(crowi.version).toBeDefined();
  16. });
  17. it('should have events initialized', () => {
  18. expect(crowi.events).toBeDefined();
  19. expect(crowi.events.user).toBeDefined();
  20. expect(crowi.events.page).toBeDefined();
  21. });
  22. it('should have configManager initialized', () => {
  23. expect(crowi.configManager).toBeDefined();
  24. });
  25. it('should have pageService initialized', () => {
  26. expect(crowi.pageService).toBeDefined();
  27. });
  28. it('should have models initialized', () => {
  29. expect(crowi.models).toBeDefined();
  30. });
  31. it('should return singleton instance on subsequent calls', async () => {
  32. const crowi2 = await getInstance();
  33. expect(crowi2).toBe(crowi);
  34. });
  35. });