@@ -3,65 +3,65 @@ import { render } from '@testing-library/react-native';
33import TraineeOrg from '../../components/trainee/Organisation' ;
44
55describe ( 'TraineeOrg Component' , ( ) => {
6- const profile = {
7- user : {
8- organizations : 'Andela' ,
9- role : 'Trainee' ,
10- team : {
11- cohort : {
12- program : {
13- name : 'Software Engineering' ,
14- } ,
15- name : 'Cohort 1' ,
16- phase : {
17- name : 'Phase 1' ,
18- } ,
19- } ,
20- name : 'Team A' ,
21- } ,
22- } ,
23- } ;
6+ const profile = {
7+ user : {
8+ organizations : 'Andela' ,
9+ role : 'Trainee' ,
10+ team : {
11+ cohort : {
12+ program : {
13+ name : 'Software Engineering' ,
14+ } ,
15+ name : 'Cohort 1' ,
16+ phase : {
17+ name : 'Phase 1' ,
18+ } ,
19+ } ,
20+ name : 'Team A' ,
21+ } ,
22+ } ,
23+ } ;
2424
25- const pulse = '<svg></svg>' ;
26- const bgColor = 'bg-white' ;
27- const textColor = 'text-black' ;
25+ const pulse = '<svg></svg>' ;
26+ const bgColor = 'bg-white' ;
27+ const textColor = 'text-black' ;
2828
29- it ( 'renders organization details correctly' , ( ) => {
30- const { getByText } = render ( < TraineeOrg profile = { profile } bgColor = { bgColor } textColor = { textColor } /> ) ;
29+ it ( 'renders organization details correctly' , ( ) => {
30+ const { getByText } = render (
31+ < TraineeOrg profile = { profile } bgColor = { bgColor } textColor = { textColor } />
32+ ) ;
3133
32- expect ( getByText ( 'YOUR ORGANISATION DETAILS' ) ) . toBeTruthy ( ) ;
33- expect ( getByText ( 'Organisation Name:' ) ) . toBeTruthy ( ) ;
34- expect ( getByText ( 'Andela' ) ) . toBeTruthy ( ) ;
35- expect ( getByText ( 'Admin email:' ) ) . toBeTruthy ( ) ;
36- expect ( getByText ( '[email protected] ' ) ) . toBeTruthy ( ) ; 37- expect ( getByText ( 'Role:' ) ) . toBeTruthy ( ) ;
38- expect ( getByText ( 'Trainee' ) ) . toBeTruthy ( ) ;
39- } ) ;
34+ expect ( getByText ( 'YOUR ORGANISATION DETAILS' ) ) . toBeTruthy ( ) ;
35+ expect ( getByText ( 'Organisation Name:' ) ) . toBeTruthy ( ) ;
36+ expect ( getByText ( 'Andela' ) ) . toBeTruthy ( ) ;
37+ expect ( getByText ( 'Admin email:' ) ) . toBeTruthy ( ) ;
38+ expect ( getByText ( '[email protected] ' ) ) . toBeTruthy ( ) ; 39+ expect ( getByText ( 'Role:' ) ) . toBeTruthy ( ) ;
40+ expect ( getByText ( 'Trainee' ) ) . toBeTruthy ( ) ;
41+ } ) ;
4042
41- it ( 'renders management details correctly' , ( ) => {
42- const { getByText } = render ( < TraineeOrg profile = { profile } bgColor = { bgColor } textColor = { textColor } /> ) ;
43+ it ( 'renders management details correctly' , ( ) => {
44+ const { getByText } = render (
45+ < TraineeOrg profile = { profile } bgColor = { bgColor } textColor = { textColor } />
46+ ) ;
4347
44- expect ( getByText ( 'MANAGEMENT' ) ) . toBeTruthy ( ) ;
45- expect ( getByText ( 'Program:' ) ) . toBeTruthy ( ) ;
46- expect ( getByText ( 'Software Engineering' ) ) . toBeTruthy ( ) ;
47- expect ( getByText ( 'Cohort :' ) ) . toBeTruthy ( ) ;
48- expect ( getByText ( 'Cohort 1' ) ) . toBeTruthy ( ) ;
49- expect ( getByText ( 'Team:' ) ) . toBeTruthy ( ) ;
50- expect ( getByText ( 'Team A' ) ) . toBeTruthy ( ) ;
51- expect ( getByText ( 'Phase:' ) ) . toBeTruthy ( ) ;
52- expect ( getByText ( 'Phase 1' ) ) . toBeTruthy ( ) ;
53- } ) ;
54- it ( 'renders unavailable text when data is missing' , ( ) => {
55- const emptyProfile = { } ;
56- const { getAllByText } = render (
57- < TraineeOrg
58- profile = { emptyProfile }
59- bgColor = "bg-white"
60- textColor = "text-black"
61- />
62- ) ;
63-
64- const unavailableElements = getAllByText ( 'Unavailable' ) ;
65- expect ( unavailableElements . length ) . toBe ( 6 ) ; // Adjust the expected count to match the actual rendered elements
66- } ) ;
67- } ) ;
48+ expect ( getByText ( 'MANAGEMENT' ) ) . toBeTruthy ( ) ;
49+ expect ( getByText ( 'Program:' ) ) . toBeTruthy ( ) ;
50+ expect ( getByText ( 'Software Engineering' ) ) . toBeTruthy ( ) ;
51+ expect ( getByText ( 'Cohort :' ) ) . toBeTruthy ( ) ;
52+ expect ( getByText ( 'Cohort 1' ) ) . toBeTruthy ( ) ;
53+ expect ( getByText ( 'Team:' ) ) . toBeTruthy ( ) ;
54+ expect ( getByText ( 'Team A' ) ) . toBeTruthy ( ) ;
55+ expect ( getByText ( 'Phase:' ) ) . toBeTruthy ( ) ;
56+ expect ( getByText ( 'Phase 1' ) ) . toBeTruthy ( ) ;
57+ } ) ;
58+ it ( 'renders unavailable text when data is missing' , ( ) => {
59+ const emptyProfile = { } ;
60+ const { getAllByText } = render (
61+ < TraineeOrg profile = { emptyProfile } bgColor = "bg-white" textColor = "text-black" />
62+ ) ;
63+
64+ const unavailableElements = getAllByText ( 'Unavailable' ) ;
65+ expect ( unavailableElements . length ) . toBe ( 6 ) ; // Adjust the expected count to match the actual rendered elements
66+ } ) ;
67+ } ) ;
0 commit comments