|
5 | 5 | */ |
6 | 6 |
|
7 | 7 | import assert from 'node:assert'; |
8 | | -import {describe, it} from 'node:test'; |
9 | 8 | import fs from 'node:fs'; |
10 | 9 | import path from 'node:path'; |
| 10 | +import { describe, it } from 'node:test'; |
11 | 11 |
|
12 | 12 | import {evaluateScript} from '../../src/tools/script.js'; |
13 | 13 | import {withMcpContext} from '../utils.js'; |
@@ -44,32 +44,35 @@ describe('a11y-debugging', () => { |
44 | 44 | assert.ok(globalPageChecksSnippet, 'Global page checks snippet not found'); |
45 | 45 |
|
46 | 46 | await withMcpContext(async (response, context) => { |
47 | | - const page = context.getSelectedPage(); |
48 | | - await page.setContent('<input id="foo"><label for="foo">Foo</label>'); |
| 47 | + const page = context.getSelectedPage(); |
| 48 | + await page.setContent('<input id="foo"><label for="foo">Foo</label>'); |
49 | 49 |
|
50 | | - // Test Orphaned Inputs Snippet |
51 | | - await evaluateScript.handler( |
52 | | - {params: {function: orphanInputsSnippet}}, |
53 | | - response, |
54 | | - context |
55 | | - ); |
56 | | - let lineEvaluation = response.responseLines.at(2)!; |
57 | | - let result = JSON.parse(lineEvaluation); |
58 | | - // Expect empty array because we have a valid label |
59 | | - assert.deepStrictEqual(result, []); |
| 50 | + // Test Orphaned Inputs Snippet |
| 51 | + await evaluateScript.handler( |
| 52 | + { params: { function: orphanInputsSnippet } }, |
| 53 | + response, |
| 54 | + context, |
| 55 | + ); |
| 56 | + let lineEvaluation = response.responseLines.at(2)!; |
| 57 | + let result = JSON.parse(lineEvaluation); |
| 58 | + // Expect empty array because we have a valid label |
| 59 | + assert.deepStrictEqual(result, []); |
60 | 60 |
|
61 | | - // Test Global Page Checks Snippet |
62 | | - response.resetResponseLineForTesting(); |
63 | | - await evaluateScript.handler( |
64 | | - {params: {function: globalPageChecksSnippet}}, |
65 | | - response, |
66 | | - context |
67 | | - ); |
68 | | - lineEvaluation = response.responseLines.at(2)!; |
69 | | - result = JSON.parse(lineEvaluation); |
70 | | - // We expect some result, just check keys |
71 | | - assert.ok('lang' in result); |
72 | | - assert.ok('title' in result); |
| 61 | + // Test Global Page Checks Snippet |
| 62 | + response.resetResponseLineForTesting(); |
| 63 | + await evaluateScript.handler( |
| 64 | + { params: { function: globalPageChecksSnippet } }, |
| 65 | + response, |
| 66 | + context, |
| 67 | + ); |
| 68 | + console.log('Global Page Checks Snippet:', globalPageChecksSnippet); |
| 69 | + const output = response.toString(); |
| 70 | + console.log('Response Output:', output); |
| 71 | + lineEvaluation = response.responseLines.at(2)!; |
| 72 | + result = JSON.parse(lineEvaluation); |
| 73 | + // We expect some result, just check keys |
| 74 | + assert.ok('lang' in result); |
| 75 | + assert.ok('title' in result); |
73 | 76 | }); |
74 | 77 | }); |
75 | 78 | }); |
0 commit comments