@@ -13,16 +13,18 @@ global.window.bootstrap = {
1313import JobLogsModal from '../src/lib/components/jobs/JobLogsModal.svelte' ;
1414
1515describe ( 'JobLogsModal' , async ( ) => {
16- it ( 'display log without highlighting ' , async ( ) => {
16+ it ( 'display error log fully highlighted ' , async ( ) => {
1717 const result = render ( JobLogsModal ) ;
1818 const error = `TASK ERROR:Task id: 20 (Create OME-Zarr structure), e.workflow_task_order=0
1919TRACEBACK:
2020Command "/tmp/FRACTAL_TASKS_DIR/.fractal/fractal-tasks-core0.14.1/venv/bin/python" is not valid. Hint: make sure that it is executable.` ;
21- await result . component . show ( error ) ;
22- expect ( result . container . querySelector ( 'pre' ) . innerHTML ) . eq ( error ) ;
21+ await result . component . show ( { status : 'failed' , log : error } ) ;
22+ const pre = result . container . querySelector ( 'pre' ) ;
23+ expect ( pre . classList . contains ( 'highlight' ) ) . eq ( true ) ;
24+ expect ( pre . innerHTML ) . eq ( error ) ;
2325 } ) ;
2426
25- it ( 'display log with highlighting' , async ( ) => {
27+ it ( 'display log with highlighting and hidden details ' , async ( ) => {
2628 const result = render ( JobLogsModal ) ;
2729 const error = `TASK ERROR:Task id: 15 (Create OME-Zarr structure), e.workflow_task_order=0
2830TRACEBACK:
@@ -37,13 +39,15 @@ Traceback (most recent call last):
3739pydantic.error_wrappers.ValidationError: 1 validation error for CreateOmeZarr
3840allowed_channels
3941 field required (type=value_error.missing)` ;
40- await result . component . show ( error ) ;
42+ await result . component . show ( { status : 'failed' , log : error } ) ;
4143 const pre = result . container . querySelector ( 'pre' ) ;
4244 let divs = pre . querySelectorAll ( 'div' ) ;
4345 expect ( divs . length ) . eq ( 2 ) ;
46+ expect ( divs [ 0 ] . classList . contains ( 'highlight' ) ) . eq ( true ) ;
4447 expect ( divs [ 0 ] . innerHTML ) . eq (
4548 'TASK ERROR:Task id: 15 (Create OME-Zarr structure), e.workflow_task_order=0\n'
4649 ) ;
50+ expect ( divs [ 1 ] . classList . contains ( 'highlight' ) ) . eq ( true ) ;
4751 expect ( divs [ 1 ] . innerHTML )
4852 . eq ( `pydantic.error_wrappers.ValidationError: 1 validation error for CreateOmeZarr
4953allowed_channels
@@ -52,7 +56,19 @@ allowed_channels
5256 await fireEvent . click ( result . getByRole ( 'button' , { name : / d e t a i l s h i d d e n / } ) ) ;
5357 divs = pre . querySelectorAll ( 'div' ) ;
5458 expect ( divs . length ) . eq ( 3 ) ;
59+ expect ( divs [ 0 ] . classList . contains ( 'highlight' ) ) . eq ( true ) ;
60+ expect ( divs [ 1 ] . classList . contains ( 'highlight' ) ) . eq ( false ) ;
61+ expect ( divs [ 2 ] . classList . contains ( 'highlight' ) ) . eq ( true ) ;
5562 expect ( divs [ 1 ] . innerHTML . startsWith ( 'TRACEBACK' ) ) . eq ( true ) ;
5663 expect ( pre . querySelectorAll ( 'button' ) . length ) . eq ( 0 ) ;
5764 } ) ;
65+
66+ it ( 'display successful log' , async ( ) => {
67+ const result = render ( JobLogsModal ) ;
68+ const log = 'Successful log...' ;
69+ await result . component . show ( { status : 'done' , log } ) ;
70+ const pre = result . container . querySelector ( 'pre' ) ;
71+ expect ( pre . classList . contains ( 'highlight' ) ) . eq ( false ) ;
72+ expect ( pre . innerHTML ) . eq ( log ) ;
73+ } ) ;
5874} ) ;
0 commit comments