@@ -5,7 +5,7 @@ import React from 'react';
5
5
import {
6
6
render , screen , cleanup , initializeMockApp , fireEvent ,
7
7
} from '../../../setupTest' ;
8
- import ProgramCertificate from '..' ;
8
+ import Certificate from '../Certificate ' ;
9
9
10
10
describe ( 'program-certificate' , ( ) => {
11
11
beforeAll ( async ( ) => {
@@ -15,30 +15,39 @@ describe('program-certificate', () => {
15
15
afterEach ( cleanup ) ;
16
16
17
17
const props = {
18
- program_title : 'Program name ' ,
19
- program_org : 'Test org' ,
18
+ credential_title : 'Certificate title ' ,
19
+ credential_org : 'Test org' ,
20
20
modified_date : '2023-02-02' ,
21
21
storages : [ { id : 'storageId' , name : 'storageName' } ] ,
22
22
handleCreate : jest . fn ( ) ,
23
23
} ;
24
24
25
- it ( 'renders the component' , ( ) => {
26
- render ( < ProgramCertificate { ...props } /> ) ;
25
+ it ( 'renders the component with type programm ' , ( ) => {
26
+ render ( < Certificate { ...props } type = "program" /> ) ;
27
27
28
28
expect ( screen . getByText ( 'Program Certificate' ) ) . toBeTruthy ( ) ;
29
- expect ( screen . getByText ( props . program_title ) ) . toBeTruthy ( ) ;
30
- expect ( screen . getByText ( props . program_org ) ) . toBeTruthy ( ) ;
29
+ expect ( screen . getByText ( props . credential_title ) ) . toBeTruthy ( ) ;
30
+ expect ( screen . getByText ( props . credential_org ) ) . toBeTruthy ( ) ;
31
31
expect ( screen . getByText ( 'Awarded on 2/2/2023' ) ) . toBeTruthy ( ) ;
32
32
} ) ;
33
33
34
- it ( 'should display "No organization" if Program Organization wasn\'t set' , ( ) => {
35
- render ( < ProgramCertificate { ...props } program_org = "" /> ) ;
34
+ it ( 'renders the component with type course' , ( ) => {
35
+ render ( < Certificate { ...props } type = "course" /> ) ;
36
+
37
+ expect ( screen . getByText ( 'Course Certificate' ) ) . toBeTruthy ( ) ;
38
+ expect ( screen . getByText ( props . credential_title ) ) . toBeTruthy ( ) ;
39
+ expect ( screen . getByText ( props . credential_org ) ) . toBeTruthy ( ) ;
40
+ expect ( screen . getByText ( 'Awarded on 2/2/2023' ) ) . toBeTruthy ( ) ;
41
+ } ) ;
42
+
43
+ it ( 'should display "No organization" if Organization wasn\'t set' , ( ) => {
44
+ render ( < Certificate { ...props } credential_org = "" /> ) ;
36
45
37
46
expect ( screen . getByText ( 'No organization' ) ) . toBeTruthy ( ) ;
38
47
} ) ;
39
48
40
49
it ( 'renders modal by clicking on a create button' , ( ) => {
41
- render ( < ProgramCertificate { ...props } /> ) ;
50
+ render ( < Certificate { ...props } /> ) ;
42
51
fireEvent . click ( screen . getByText ( 'Create' ) ) ;
43
52
44
53
expect ( screen . findByTitle ( 'Verifiable credential' ) ) . toBeTruthy ( ) ;
0 commit comments