Prepare verified laboratory 6 implementation and evidence

This commit is contained in:
rey
2026-11-17 17:32:06 +03:00
parent 470d9d6f1e
commit 7d56e52fd0
335 changed files with 31206 additions and 72 deletions
+13
View File
@@ -0,0 +1,13 @@
export function dashboardMatches(actual:any,expected:any):boolean{
const panels=actual?.dashboard?.panels,configured=expected?.panels;
if(typeof expected?.uid!=='string'||actual?.dashboard?.uid!==expected.uid||!Array.isArray(panels)||!Array.isArray(configured)||!configured.length||panels.length!==configured.length)return false;
const valid=(p:any)=>Number.isSafeInteger(p?.id)&&p.id>0&&typeof p.title==='string'&&p.title.length>0;
if(!configured.every(valid)||!panels.every(valid))return false;
const wanted=new Map(configured.map(p=>[p.id,p.title]));
return wanted.size===configured.length&&new Set(panels.map(p=>p.id)).size===panels.length&&panels.every(p=>wanted.get(p.id)===p.title);
}
export function rulesMatch(actual:any,expected:string[]):boolean{
if(!Array.isArray(actual)||!Array.isArray(expected)||!expected.length||actual.length!==expected.length||!expected.every(v=>typeof v==='string'&&v.length>0))return false;
const wanted=new Set(expected),got=new Set(actual.map(row=>row?.uid));
return wanted.size===expected.length&&got.size===actual.length&&[...got].every(uid=>wanted.has(uid));
}