Skip to content

Commit 593568a

Browse files
committed
Use Opportunity factory consistently
Issue #2189 Use factories in tests
1 parent 163782e commit 593568a

2 files changed

Lines changed: 9 additions & 30 deletions

File tree

src/__tests__/opportunities.int.test.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,8 @@ describe('/opportunities', () => {
5757
const testUserAuthContext = getAuthContext(testUser);
5858

5959
const systemOpportunity = await loadSystemOpportunity(db, null);
60-
const opportunity1 = await createTestOpportunity(
61-
db,
62-
testUserAuthContext,
63-
{
64-
title: 'Tremendous opportunity 👌',
65-
},
66-
);
67-
const opportunity2 = await createTestOpportunity(
68-
db,
69-
testUserAuthContext,
70-
{
71-
title: 'Terrific opportunity 👐',
72-
},
73-
);
60+
const opportunity1 = await createTestOpportunity(db, testUserAuthContext);
61+
const opportunity2 = await createTestOpportunity(db, testUserAuthContext);
7462
const response = await request(app)
7563
.get('/opportunities')
7664
.set(authHeaderWithAdminRole)
@@ -102,7 +90,6 @@ describe('/opportunities', () => {
10290
db,
10391
testUserAuthContext,
10492
{
105-
title: 'Tremendous opportunity 👌',
10693
funderShortCode: visibleFunder.shortCode,
10794
},
10895
);

src/__tests__/proposalVersions.int.test.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
getDatabase,
55
createApplicationForm,
66
createApplicationFormField,
7-
createOpportunity,
87
createOrUpdateBaseField,
98
createProposalVersion,
109
loadPermissionGrantBundle,
@@ -1121,8 +1120,7 @@ describe('/proposalVersions', () => {
11211120
shortCode: 'orgName',
11221121
});
11231122

1124-
const opportunity = await createOpportunity(db, testUserAuthContext, {
1125-
title: 'Conditional Test Opportunity',
1123+
const opportunity = await createTestOpportunity(db, testUserAuthContext, {
11261124
funderShortCode: systemFunder.shortCode,
11271125
});
11281126
const proposal = await createTestProposal(db, testUserAuthContext, {
@@ -1234,8 +1232,7 @@ describe('/proposalVersions', () => {
12341232
shortCode: 'orgName',
12351233
});
12361234

1237-
const opportunity = await createOpportunity(db, testUserAuthContext, {
1238-
title: 'No Conditions Test Opportunity',
1235+
const opportunity = await createTestOpportunity(db, testUserAuthContext, {
12391236
funderShortCode: systemFunder.shortCode,
12401237
});
12411238
const proposal = await createTestProposal(db, testUserAuthContext, {
@@ -1331,8 +1328,7 @@ describe('/proposalVersions', () => {
13311328
shortCode: 'orgName',
13321329
});
13331330

1334-
const opportunity = await createOpportunity(db, testUserAuthContext, {
1335-
title: 'Exclusion Test Opportunity',
1331+
const opportunity = await createTestOpportunity(db, testUserAuthContext, {
13361332
funderShortCode: systemFunder.shortCode,
13371333
});
13381334
const proposal = await createTestProposal(db, testUserAuthContext, {
@@ -1421,8 +1417,7 @@ describe('/proposalVersions', () => {
14211417
shortCode: 'orgName',
14221418
});
14231419

1424-
const opportunity = await createOpportunity(db, testUserAuthContext, {
1425-
title: 'Equals Test Opportunity',
1420+
const opportunity = await createTestOpportunity(db, testUserAuthContext, {
14261421
funderShortCode: systemFunder.shortCode,
14271422
});
14281423
const proposal = await createTestProposal(db, testUserAuthContext, {
@@ -1532,11 +1527,10 @@ describe('/proposalVersions', () => {
15321527
});
15331528

15341529
// Set up opportunity + proposal + field values for the OTHER funder
1535-
const otherOpportunity = await createOpportunity(
1530+
const otherOpportunity = await createTestOpportunity(
15361531
db,
15371532
testUserAuthContext,
15381533
{
1539-
title: 'Other Funder Opportunity',
15401534
funderShortCode: otherFunder.shortCode,
15411535
},
15421536
);
@@ -1620,11 +1614,10 @@ describe('/proposalVersions', () => {
16201614
});
16211615

16221616
// Set up data for the GRANTED funder
1623-
const grantedOpportunity = await createOpportunity(
1617+
const grantedOpportunity = await createTestOpportunity(
16241618
db,
16251619
testUserAuthContext,
16261620
{
1627-
title: 'Granted Funder Opportunity',
16281621
funderShortCode: grantedFunder.shortCode,
16291622
},
16301623
);
@@ -1682,11 +1675,10 @@ describe('/proposalVersions', () => {
16821675
});
16831676

16841677
// Set up data for the OTHER funder
1685-
const otherOpportunity = await createOpportunity(
1678+
const otherOpportunity = await createTestOpportunity(
16861679
db,
16871680
testUserAuthContext,
16881681
{
1689-
title: 'Other Funder Opportunity',
16901682
funderShortCode: otherFunder.shortCode,
16911683
},
16921684
);

0 commit comments

Comments
 (0)