(snapshot)
| 1993 | } |
| 1994 | |
| 1995 | function countAccessibilityNodes(snapshot) { |
| 1996 | const roots = Array.isArray(snapshot?.roots) ? snapshot.roots : []; |
| 1997 | let count = 0; |
| 1998 | const visit = (node) => { |
| 1999 | if (!node || typeof node !== "object") { |
| 2000 | return; |
| 2001 | } |
| 2002 | count += 1; |
| 2003 | for (const child of Array.isArray(node.children) ? node.children : []) { |
| 2004 | visit(child); |
| 2005 | } |
| 2006 | }; |
| 2007 | for (const root of roots) { |
| 2008 | visit(root); |
| 2009 | } |
| 2010 | return count; |
| 2011 | } |
| 2012 | |
| 2013 | function assertJson(payload, label) { |
| 2014 | if (!payload || typeof payload !== "object") { |
no test coverage detected