Skip to content

Commit d3dcdd4

Browse files
committed
remove email field from user entity and update tests to assert email absence in various scenarios
1 parent 1b7019e commit d3dcdd4

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

src/entities/user.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export const publicSelectionFields = [
3737
'user.passportScore',
3838
'user.passportStamps',
3939
'user.acceptedToS',
40-
'user.email',
4140
'user.qaccPoints',
4241
'user.username',
4342
];

src/repositories/userRepository.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ function findUserByWalletAddressTestCases() {
335335
);
336336
assert.isOk(foundUser);
337337
assert.equal(foundUser?.walletAddress, user.walletAddress);
338-
assert.isOk(foundUser?.email);
338+
assert.isNotOk(foundUser?.email);
339339
});
340340

341341
it('Should find user by walletAddress with all fields', async () => {

src/resolvers/donationResolver.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ function donationsTestCases() {
751751
assert.isOk(donations.find(d => Number(d.id) === oldDonation.id));
752752
assert.notOk(donations.find(d => Number(d.id) === newDonation.id));
753753
donations.forEach(donation => {
754-
assert.isOk(donation.user.email);
754+
assert.isNotOk(donation.user.email);
755755
assert.isOk(donation.user.firstName);
756756
assert.isOk(donation.user.walletAddress);
757757
});
@@ -2927,7 +2927,7 @@ function donationsFromWalletsTestCases() {
29272927
// assert.isNotEmpty(result.data.data.donationsFromWallets);
29282928
result.data.data.donationsFromWallets.forEach(item => {
29292929
assert.equal(item.fromWalletAddress, walletAddress);
2930-
assert.isOk(item.user.email);
2930+
assert.isNotOk(item.user.email);
29312931
assert.isOk(item.user.walletAddress);
29322932
});
29332933
});
@@ -2953,7 +2953,7 @@ function donationsFromWalletsTestCases() {
29532953

29542954
result.data.data.donationsFromWallets.forEach(item => {
29552955
assert.equal(item.fromWalletAddress, walletAddress);
2956-
assert.isOk(item.user.email);
2956+
assert.isNotOk(item.user.email);
29572957
assert.isOk(item.user.walletAddress);
29582958
});
29592959
});
@@ -2991,7 +2991,7 @@ function donationsFromWalletsTestCases() {
29912991
item.fromWalletAddress.toLowerCase(),
29922992
walletAddress.toLowerCase(),
29932993
);
2994-
assert.isOk(item.user.email);
2994+
assert.isNotOk(item.user.email);
29952995
assert.isOk(item.user.walletAddress);
29962996
});
29972997
});
@@ -3193,7 +3193,7 @@ function donationsByProjectIdTestCases() {
31933193
const donations = result.data.data.donationsByProjectId.donations;
31943194
assert.equal(Number(donations[0].id), DONATION_SEED_DATA.FIFTH_DONATION.id);
31953195
donations.forEach(donation => {
3196-
assert.isOk(donation.user.email);
3196+
assert.isNotOk(donation.user.email);
31973197
assert.isOk(donation.user.firstName);
31983198
assert.isOk(donation.user.walletAddress);
31993199
});
@@ -4363,7 +4363,7 @@ function donationsByDonorTestCases() {
43634363
SEED_DATA.FIRST_USER.walletAddress,
43644364
);
43654365
firstUserResult.data.data.donationsByDonor.forEach(donation => {
4366-
assert.isOk(donation.user.email);
4366+
assert.isNotOk(donation.user.email);
43674367
assert.isOk(donation.user.firstName);
43684368
assert.isOk(donation.user.walletAddress);
43694369
});
@@ -4416,7 +4416,7 @@ function donationsToWalletsTestCases() {
44164416
// assert.isNotEmpty(result.data.data.donationsToWallets);
44174417
result.data.data.donationsToWallets.forEach(item => {
44184418
assert.equal(item.toWalletAddress, project.walletAddress);
4419-
assert.isOk(item.user.email);
4419+
assert.isNotOk(item.user.email);
44204420
assert.isOk(item.user.walletAddress);
44214421
});
44224422
});

src/resolvers/projectResolver.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ function projectsByUserIdTestCases() {
622622
assert.isOk(project.adminUser.walletAddress);
623623
assert.isOk(project.adminUser.firstName);
624624
assert.isNull(project.projectVerificationForm);
625-
assert.isOk(project.adminUser.email);
625+
assert.isNotOk(project.adminUser.email);
626626
});
627627
});
628628

@@ -641,7 +641,7 @@ function projectsByUserIdTestCases() {
641641
projects.forEach(project => {
642642
assert.isOk(project.adminUser.walletAddress);
643643
assert.isOk(project.adminUser.firstName);
644-
assert.isOk(project.adminUser.email);
644+
assert.isNotOk(project.adminUser.email);
645645
});
646646
});
647647
}
@@ -660,7 +660,7 @@ function projectByIdTestCases() {
660660
assert.isNotEmpty(result.data.data.projectById.addresses);
661661
assert.isOk(result.data.data.projectById.adminUser.walletAddress);
662662
assert.isOk(result.data.data.projectById.adminUser.firstName);
663-
assert.isOk(result.data.data.projectById.adminUser.email);
663+
assert.isNotOk(result.data.data.projectById.adminUser.email);
664664
assert.isOk(result.data.data.projectById.categories[0].mainCategory.title);
665665
});
666666
it('should return error for invalid id', async () => {
@@ -690,7 +690,7 @@ function projectByIdTestCases() {
690690
assert.equal(result.data.data.projectById.id, project.id);
691691
assert.isOk(result.data.data.projectById.adminUser.walletAddress);
692692
assert.isOk(result.data.data.projectById.adminUser.firstName);
693-
assert.isOk(result.data.data.projectById.adminUser.email);
693+
assert.isNotOk(result.data.data.projectById.adminUser.email);
694694
assert.isNotOk(result.data.data.projectById.reaction);
695695
});
696696
it('should not return reaction when user didnt like the project', async () => {
@@ -708,7 +708,7 @@ function projectByIdTestCases() {
708708
assert.isNotOk(result.data.data.projectById.reaction);
709709
assert.isOk(result.data.data.projectById.adminUser.walletAddress);
710710
assert.isOk(result.data.data.projectById.adminUser.firstName);
711-
assert.isOk(result.data.data.projectById.adminUser.email);
711+
assert.isNotOk(result.data.data.projectById.adminUser.email);
712712
});
713713
it('should not return drafted projects if not logged in', async () => {
714714
const draftedProject = await saveProjectDirectlyToDb({
@@ -760,7 +760,7 @@ function projectByIdTestCases() {
760760
assert.equal(Number(project.id), draftedProject.id);
761761
assert.isOk(project.adminUser.walletAddress);
762762
assert.isOk(project.adminUser.firstName);
763-
assert.isOk(project.adminUser.email);
763+
assert.isNotOk(project.adminUser.email);
764764
});
765765
it('should not return drafted project is user is logged in but is not owner of project', async () => {
766766
const accessToken = await generateTestAccessToken(SEED_DATA.SECOND_USER.id);
@@ -844,7 +844,7 @@ function projectByIdTestCases() {
844844
assert.equal(Number(project.id), cancelledProject.id);
845845
assert.isOk(project.adminUser.walletAddress);
846846
assert.isOk(project.adminUser.firstName);
847-
assert.isOk(project.adminUser.email);
847+
assert.isNotOk(project.adminUser.email);
848848
});
849849
it('should not return cancelled project is user is logged in but is not owner of project', async () => {
850850
const accessToken = await generateTestAccessToken(SEED_DATA.SECOND_USER.id);
@@ -959,7 +959,7 @@ function projectBySlugTestCases() {
959959
assert.equal(Number(project.id), project1.id);
960960
assert.isOk(project.adminUser.walletAddress);
961961
assert.isOk(project.adminUser.firstName);
962-
assert.isOk(project.adminUser.email);
962+
assert.isNotOk(project.adminUser.email);
963963
assert.isOk(project.categories[0].mainCategory.title);
964964
});
965965

@@ -996,7 +996,7 @@ function projectBySlugTestCases() {
996996
assert.equal(Number(project.id), Number(_project.id));
997997
assert.isOk(project.adminUser.walletAddress);
998998
assert.isOk(project.adminUser.firstName);
999-
assert.isOk(project.adminUser.email);
999+
assert.isNotOk(project.adminUser.email);
10001000
assert.isNotEmpty(project.addresses);
10011001
assert.equal(project.addresses[0].address, walletAddress);
10021002
assert.equal(project.addresses[0].chainType, ChainType.EVM);

src/resolvers/userResolver.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function userByAddressTestCases() {
167167
assert.equal(result.data.data.userByAddress.firstName, userData.firstName);
168168
assert.equal(result.data.data.userByAddress.lastName, userData.lastName);
169169
assert.isNotOk(result.data.data.userByAddress.role);
170-
assert.equal(result.data.data.userByAddress.email, userData.email);
170+
assert.isNotOk(result.data.data.userByAddress.email);
171171
assert.equal(result.data.data.userByAddress.url, userData.url);
172172
});
173173
it('Get all fields of a user', async () => {

0 commit comments

Comments
 (0)