@@ -2,6 +2,17 @@ import '../../support/pkp-mock.js';
22import CodecheckReviewDisplay from '../../../resources/js/Components/CodecheckReviewDisplay.vue' ;
33
44describe ( 'CodecheckReviewDisplay Component' , ( ) => {
5+ beforeEach ( ( ) => {
6+ let status = 'plugins.generic.codecheck.status.needsCodechecker' ;
7+
8+ cy . intercept ( 'GET' , '**/codecheck/status*' , {
9+ statusCode : 200 ,
10+ body : {
11+ statusRecord : { status : status }
12+ }
13+ } ) . as ( 'getStatus' ) ;
14+ } ) ;
15+
516 it ( 'shows not opted in message when codecheckOptIn is false' , ( ) => {
617 cy . mount ( CodecheckReviewDisplay , {
718 props : {
@@ -15,39 +26,28 @@ describe('CodecheckReviewDisplay Component', () => {
1526 cy . get ( '.codecheck-info' ) . should ( 'not.exist' ) ;
1627 } ) ;
1728
18- it ( 'shows pending status when opted in but no metadata' , ( ) => {
19- cy . mount ( CodecheckReviewDisplay , {
20- props : {
21- submission : {
22- codecheckOptIn : true ,
23- codecheckMetadata : { }
24- }
25- }
26- } ) ;
27-
28- cy . get ( '.status-pending' ) . should ( 'exist' ) ;
29- cy . contains ( 'plugins.generic.codecheck.status.pending' ) . should ( 'exist' ) ;
30- } ) ;
29+ it ( 'shows status' , ( ) => {
30+ let status = 'plugins.generic.codecheck.status.needsCodechecker' ;
31+
32+ cy . intercept ( 'GET' , '**/codecheck/status*' , {
33+ body : { statusRecord : { status : status } }
34+ } ) . as ( 'getStatus' ) ;
3135
32- it ( 'shows in-progress status with partial metadata' , ( ) => {
3336 cy . mount ( CodecheckReviewDisplay , {
3437 props : {
3538 submission : {
39+ id : 1 ,
3640 codecheckOptIn : true ,
37- codecheckMetadata : {
38- configVersion : 'latest' ,
39- manifest : [ { file : 'output.png' } ] ,
40- codecheckers : [ { name : 'John Doe' } ]
41- }
41+ codecheckMetadata : { }
4242 }
4343 }
4444 } ) ;
4545
46- cy . get ( '.status-in-progress' ) . should ( 'exist ') ;
47- cy . contains ( 'plugins.generic.codecheck. status.inProgress' ) . should ( 'exist' ) ;
46+ cy . wait ( '@getStatus ') ;
47+ cy . contains ( status ) . should ( 'exist' ) ;
4848 } ) ;
4949
50- it ( 'shows complete status with full metadata' , ( ) => {
50+ it ( 'shows complete information with full metadata' , ( ) => {
5151 cy . mount ( CodecheckReviewDisplay , {
5252 props : {
5353 submission : {
@@ -67,7 +67,6 @@ describe('CodecheckReviewDisplay Component', () => {
6767 }
6868 } ) ;
6969
70- cy . get ( '.status-complete' ) . should ( 'exist' ) ;
7170 cy . contains ( 'CODECHECK-2024-001' ) . should ( 'exist' ) ;
7271 cy . contains ( 'John Doe' ) . should ( 'exist' ) ;
7372 cy . contains ( '0000-0001-2345-6789' ) . should ( 'exist' ) ;
0 commit comments