| 9 | import type { A11yAuditResult } from '../src/core/types/types' |
| 10 | |
| 11 | const createMockResult = (): A11yAuditResult => ({ |
| 12 | issues: [ |
| 13 | { |
| 14 | id: 'issue-1', |
| 15 | ruleId: 'image-alt', |
| 16 | impact: 'critical', |
| 17 | message: 'Images must have alternate text', |
| 18 | help: 'Images must have alternate text', |
| 19 | helpUrl: 'https://dequeuniversity.com/rules/axe/4.0/image-alt', |
| 20 | wcagTags: ['wcag2a', 'wcag111'], |
| 21 | nodes: [ |
| 22 | { |
| 23 | selector: 'img.logo', |
| 24 | html: '<img class="logo" src="logo.png">', |
| 25 | failureSummary: 'Fix this issue by adding an alt attribute', |
| 26 | }, |
| 27 | ], |
| 28 | meetsThreshold: true, |
| 29 | timestamp: 1704067200000, |
| 30 | }, |
| 31 | { |
| 32 | id: 'issue-2', |
| 33 | ruleId: 'button-name', |
| 34 | impact: 'serious', |
| 35 | message: 'Buttons must have discernible text', |
| 36 | help: 'Buttons must have discernible text', |
| 37 | helpUrl: 'https://dequeuniversity.com/rules/axe/4.0/button-name', |
| 38 | wcagTags: ['wcag2a', 'wcag412'], |
| 39 | nodes: [ |
| 40 | { |
| 41 | selector: 'button.submit', |
| 42 | html: '<button class="submit"></button>', |
| 43 | failureSummary: 'Add text or aria-label to the button', |
| 44 | }, |
| 45 | { |
| 46 | selector: 'button.cancel', |
| 47 | html: '<button class="cancel"></button>', |
| 48 | failureSummary: 'Add text or aria-label to the button', |
| 49 | }, |
| 50 | ], |
| 51 | meetsThreshold: true, |
| 52 | timestamp: 1704067200000, |
| 53 | }, |
| 54 | ], |
| 55 | summary: { |
| 56 | total: 2, |
| 57 | critical: 1, |
| 58 | serious: 1, |
| 59 | moderate: 0, |
| 60 | minor: 0, |
| 61 | passes: 50, |
| 62 | incomplete: 3, |
| 63 | }, |
| 64 | timestamp: 1704067200000, |
| 65 | url: 'http://localhost:3000/', |
| 66 | context: 'document', |
| 67 | duration: 123.45, |
| 68 | }) |