test: show Human Gate project in review detail
This commit is contained in:
parent
e02115bd71
commit
364fc60116
|
|
@ -59,6 +59,7 @@ function createHumanGates(options = {}) {
|
|||
const history = (item.history || []).map(event => '<li><strong>' + escape(event.action) + '</strong> · ' + escape(event.at) + '</li>').join('');
|
||||
setHtml(nodes.detail,
|
||||
'<article class="human-gate-detail"><h3>' + escape(item.title) + '</h3>' +
|
||||
'<p>Project <strong>' + escape(item.project) + '</strong></p>' +
|
||||
'<p>Exact candidate <code>' + escape(item.candidate_hash) + '</code></p>' +
|
||||
'<p>Score ' + escape(item.score?.value ?? 'not supplied') + ' · ' + escape(item.score?.provenance || '') + '</p>' +
|
||||
'<h4>Artifacts</h4><ul>' + artifacts + '</ul><h4>Links</h4><ul>' + links + '</ul>' +
|
||||
|
|
|
|||
|
|
@ -47,11 +47,12 @@ const gates=createHumanGates({storage:{getItem:()=>null,setItem(){}},getLogin:()
|
|||
|
||||
def test_review_loads_exact_detail_with_links_provenance_and_history():
|
||||
output = run_node(r"""
|
||||
const detail={id:'g1',title:'Candidate',candidate_hash:'abc123',revision:1,checks:[{name:'unit',state:'success',required:true}],artifacts:[{name:'manifest',url:'https://forge.example/manifest'}],links:[{label:'pull',url:'https://forge.example/pull/1'}],score:{value:98,provenance:'eval/v1'},provenance:{producer:'bot',run_id:'9'},history:[{action:'intake',at:100}]};
|
||||
const detail={id:'g1',title:'Candidate',project:'stackchain/dashboard',candidate_hash:'abc123',revision:1,checks:[{name:'unit',state:'success',required:true}],artifacts:[{name:'manifest',url:'https://forge.example/manifest'}],links:[{label:'pull',url:'https://forge.example/pull/1'}],score:{value:98,provenance:'eval/v1'},provenance:{producer:'bot',run_id:'9'},history:[{action:'intake',at:100}]};
|
||||
const nodes={count:{},list:{},status:{},panel:{},detail:{innerHTML:''}};
|
||||
const gates=createHumanGates({storage:{getItem:()=>null,setItem(){}},getLogin:()=> 'timmy',isOnline:()=>true,nodes,location:{hash:''},fetchJson:async path=>path.endsWith('/g1')?detail:{pending_count:1,items:[detail]}});
|
||||
(async()=>{await gates.load();gates.reviewNext();await new Promise(resolve=>setTimeout(resolve,0));process.stdout.write(JSON.stringify({html:nodes.detail.innerHTML}));})();
|
||||
""")
|
||||
assert "stackchain/dashboard" in output["html"]
|
||||
assert "https://forge.example/pull/1" in output["html"]
|
||||
assert "bot" in output["html"]
|
||||
assert "intake" in output["html"]
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user