TestValidatePlaywrightMode tests the validatePlaywrightMode deprecation warning.
(t *testing.T)
| 11 | |
| 12 | // TestValidatePlaywrightMode tests the validatePlaywrightMode deprecation warning. |
| 13 | func TestValidatePlaywrightMode(t *testing.T) { |
| 14 | tests := []struct { |
| 15 | name string |
| 16 | tools map[string]any |
| 17 | strictMode bool |
| 18 | expectWarn bool |
| 19 | expectError bool |
| 20 | errorSubstr string |
| 21 | }{ |
| 22 | { |
| 23 | name: "playwright not configured", |
| 24 | tools: map[string]any{}, |
| 25 | expectWarn: false, |
| 26 | }, |
| 27 | { |
| 28 | name: "playwright set to false", |
| 29 | tools: map[string]any{"playwright": false}, |
| 30 | expectWarn: false, |
| 31 | }, |
| 32 | { |
| 33 | name: "playwright nil (enabled with default settings)", |
| 34 | tools: map[string]any{"playwright": nil}, |
| 35 | expectWarn: true, |
| 36 | }, |
| 37 | { |
| 38 | name: "playwright enabled with empty map (MCP mode default)", |
| 39 | tools: map[string]any{"playwright": map[string]any{}}, |
| 40 | expectWarn: true, |
| 41 | }, |
| 42 | { |
| 43 | name: "playwright explicit mcp mode", |
| 44 | tools: map[string]any{"playwright": map[string]any{"mode": "mcp"}}, |
| 45 | expectWarn: true, |
| 46 | }, |
| 47 | { |
| 48 | name: "playwright cli mode — no warning", |
| 49 | tools: map[string]any{"playwright": map[string]any{"mode": "cli"}}, |
| 50 | expectWarn: false, |
| 51 | }, |
| 52 | { |
| 53 | name: "playwright cli mode uppercase — no warning", |
| 54 | tools: map[string]any{"playwright": map[string]any{"mode": "CLI"}}, |
| 55 | expectWarn: false, |
| 56 | }, |
| 57 | { |
| 58 | name: "playwright mcp mode in strict mode warns only", |
| 59 | tools: map[string]any{"playwright": map[string]any{"mode": "mcp"}}, |
| 60 | strictMode: true, |
| 61 | expectWarn: true, |
| 62 | }, |
| 63 | { |
| 64 | name: "playwright nil (default MCP) in strict mode warns only", |
| 65 | tools: map[string]any{"playwright": nil}, |
| 66 | strictMode: true, |
| 67 | expectWarn: true, |
| 68 | }, |
| 69 | } |
| 70 |
nothing calls this directly
no test coverage detected