Skip to content

Commit 0f433c5

Browse files
authored
test: show mentee email upon approval (#855)
1 parent 201d9b9 commit 0f433c5

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

cypress/fixtures/mentorship-requests/get.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"id": "001",
88
"name": "User 001",
99
"avatar": "https://avatars0.githubusercontent.com/u/219207?s=88&v=4",
10-
"title": "J web dev"
10+
"title": "J web dev",
11+
"email": "mentee@codingcoach.io"
1112
},
1213
"status": "Approved",
1314
"date": 1609748339000,
@@ -22,7 +23,8 @@
2223
"id": "002",
2324
"name": "User 002",
2425
"avatar": "https://avatars0.githubusercontent.com/u/219207?s=88&v=4",
25-
"title": "J web dev"
26+
"title": "J web dev",
27+
"email": "mentee@codingcoach.io"
2628
},
2729
"status": "Rejected",
2830
"date": 1604013539000,
@@ -37,7 +39,8 @@
3739
"id": "003",
3840
"name": "User 003",
3941
"avatar": "https://avatars0.githubusercontent.com/u/219207?s=88&v=4",
40-
"title": "J web dev"
42+
"title": "J web dev",
43+
"email": "mentee@codingcoach.io"
4144
},
4245
"status": "New",
4346
"date": 1609283939000,

cypress/integration/me/mentorship-requests.spec.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('Mentorship Requests', () => {
4848
const errorMessage =
4949
'Unable to find an element by: [data-testid="request-content"]';
5050

51-
cy.on('fail', err => {
51+
cy.on('fail', (err) => {
5252
expect(err.message).to.contain(errorMessage);
5353
});
5454

@@ -67,7 +67,7 @@ describe('Mentorship Requests', () => {
6767
it('Should only expand one item at a time', () => {
6868
const { message } = reqType.new;
6969
const errorMessage = `Unable to find an element with the text: ${message}`;
70-
cy.on('fail', err => {
70+
cy.on('fail', (err) => {
7171
expect(err.message).to.contain(errorMessage);
7272
});
7373

@@ -81,16 +81,22 @@ describe('Mentorship Requests', () => {
8181
});
8282
});
8383

84-
it('Should have Message, Background and Expectation', () => {
84+
it.only('Should have Message, Background, Expectation and mentee email', () => {
8585
cy.findAllByTestId('request-content')
8686
.findAllByText(/Message|Background|Expectations/)
8787
.should('have.length', 3);
8888
cy.findAllByTestId('request-content')
8989
.get('p')
90-
.then($ps => {
90+
.then(($ps) => {
9191
// 3 for each mentorship request + 1 no My Mentorship Requests
9292
expect($ps).to.have.length(10);
9393
});
94+
95+
cy.findAllByText('Send a message').should(
96+
'have.attr',
97+
'href',
98+
'mailto:mentee@codingcoach.io'
99+
);
94100
});
95101
});
96102
});
@@ -123,9 +129,7 @@ describe('Mentorship Requests', () => {
123129
}).as('updateMentorshipStatus');
124130
cy.visit(`/me/requests`);
125131

126-
cy.get('li')
127-
.contains(mentorships[0].mentor.name)
128-
.click();
132+
cy.get('li').contains(mentorships[0].mentor.name).click();
129133
});
130134

131135
it('should display cancel button', () => {

src/Me/MentorshipRequests/ReqContent.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const ReqContent = ({
6060
isLoading,
6161
menteeEmail,
6262
user,
63-
mentee
63+
mentee,
6464
}) => {
6565
const shouldShowButtons = () => {
6666
const requestReviewed = [
@@ -121,18 +121,19 @@ const ReqContent = ({
121121
arrow={true}
122122
position="top"
123123
>
124-
<a
125-
onClick={() => report('mentorship request', 'send message')}
126-
href={`mailto:${menteeEmail}`}
127-
>
128-
Send a message
129-
</a>
124+
<a
125+
onClick={() => report('mentorship request', 'send message')}
126+
href={`mailto:${menteeEmail}`}
127+
>
128+
Send a message
129+
</a>
130130
</Tooltip>
131131
</CallToAction>
132132
)}
133133
{status === 'Approved' && user === mentee && (
134134
<a
135-
id="menteeEmailLink" onClick={() => report('mentorship request', 'send message')}
135+
id="menteeEmailLink"
136+
onClick={() => report('mentorship request', 'send message')}
136137
href={`mailto:${menteeEmail}`}
137138
>
138139
Send a message

0 commit comments

Comments
 (0)