-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feat/implement-testco…
…ntainers
- Loading branch information
Showing
11 changed files
with
170 additions
and
124 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -360,11 +360,19 @@ describe('NewConnectionController', () => { | |
}) | ||
|
||
it('should send second email to admin', () => { | ||
expect(emailSpy.firstCall.args[0]).equal('connection_invite') | ||
expect(emailSpy.secondCall.args[0]).equal('connection_invite_admin') | ||
expect(emailSpy.secondCall.args[1]?.address).equal( | ||
'NAME, ADDRESS_LINE_1, ADDRESS_LINE_2, CARE_OF, LOCALITY, PO_BOX, POSTAL_CODE, COUNTRY, PREMISES, REGION' | ||
) | ||
expect(emailSpy.firstCall.args[1]).to.deep.contain({ | ||
to: '[email protected]', | ||
toCompanyName: 'NAME', | ||
fromCompanyName: 'COMPANY_NAME', | ||
}) | ||
expect(emailSpy.secondCall.args[1]?.pin).match(/[0-9]{6}/) | ||
expect(emailSpy.secondCall.args[1]).to.deep.contain({ | ||
receiver: 'NAME', | ||
address: | ||
'NAME, ADDRESS_LINE_1, ADDRESS_LINE_2, CARE_OF, LOCALITY, PO_BOX, POSTAL_CODE, COUNTRY, PREMISES, REGION', | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
@@ -545,10 +553,12 @@ describe('NewConnectionController', () => { | |
|
||
it('should send email to admin', () => { | ||
expect(emailSpy.firstCall.args[0]).equal('connection_invite_admin') | ||
expect(emailSpy.firstCall.args[1]?.address).equal( | ||
'NAME, ADDRESS_LINE_1, ADDRESS_LINE_2, CARE_OF, LOCALITY, PO_BOX, POSTAL_CODE, COUNTRY, PREMISES, REGION' | ||
) | ||
expect(emailSpy.firstCall.args[1]?.pin).match(/[0-9]{6}/) | ||
expect(emailSpy.firstCall.args[1]).to.deep.contain({ | ||
receiver: 'NAME', | ||
address: | ||
'NAME, ADDRESS_LINE_1, ADDRESS_LINE_2, CARE_OF, LOCALITY, PO_BOX, POSTAL_CODE, COUNTRY, PREMISES, REGION', | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import { expect, Page, test } from '@playwright/test' | ||
import { cleanup, CustomBrowserContext, withLoggedInUser, withRegisteredAccount } from './helpers/registerLogIn.js' | ||
import { checkEmails, extractInvite, extractPin, findNewAdminEmail } from './helpers/smtpEmails.js' | ||
import { checkEmails, extractInvite, extractPin } from './helpers/smtpEmails.js' | ||
|
||
test.describe('Connection from Alice to Bob', () => { | ||
let context: CustomBrowserContext | ||
let page: Page | ||
let adminEmailId: string | ||
let invite: string | null | ||
let pinForBob: string | ||
let pinForAlice: string | ||
|
@@ -73,7 +72,6 @@ test.describe('Connection from Alice to Bob', () => { | |
await test.step('Retrieve invite and pin for Bob', async () => { | ||
const adminEmail = await checkEmails('[email protected]') | ||
const inviteEmail = await checkEmails('[email protected]') | ||
adminEmailId = adminEmail.id | ||
|
||
const extractedPin = await extractPin(adminEmail.id) | ||
expect(extractedPin).toHaveLength(6) | ||
|
@@ -123,7 +121,7 @@ test.describe('Connection from Alice to Bob', () => { | |
}) | ||
|
||
await test.step('Retrieve pin for Alice', async () => { | ||
const newAdminEmail = await findNewAdminEmail(adminEmailId) | ||
const newAdminEmail = await checkEmails('[email protected]') | ||
const extractedPin = await extractPin(newAdminEmail.id) | ||
expect(extractedPin).toHaveLength(6) | ||
if (!extractedPin) throw new Error('PIN from admin email was not found.') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ describe('SMTP email', () => { | |
await cleanupCloudagent() | ||
server.cloudagentEvents.stop() | ||
}) | ||
|
||
it('should send an email via SMTP', async () => { | ||
const options = { | ||
hostname: 'localhost', | ||
|
@@ -75,26 +76,45 @@ describe('SMTP email', () => { | |
const parsedMessages = EmailResponseSchema.parse(messages) | ||
const results = parsedMessages['results'] | ||
expect(results).to.be.an('array') | ||
expect(results).length(2) | ||
expect(results[0]).to.have.property('deliveredTo').that.is.equal('[email protected]') | ||
expect(results[1]).to.have.property('deliveredTo').that.is.equal('[email protected]') | ||
|
||
// Invite email assertions | ||
const inviteEmail = results.find( | ||
(msg) => msg.subject === `${validCompanyName} invites you to a secure, verified connection on Veritable` | ||
) | ||
if (inviteEmail) { | ||
expect(inviteEmail.to).to.have.lengthOf(1) | ||
expect(inviteEmail.to[0]).to.contain('[email protected]') | ||
expect(inviteEmail).to.deep.contain({ | ||
isRelayed: false, | ||
deliveredTo: '[email protected]', | ||
from: '[email protected]', | ||
to: ['[email protected]'], | ||
subject: 'DIGITAL CATAPULT invites you to a secure, verified connection on Veritable', | ||
attachmentCount: 0, | ||
isUnread: true, | ||
}) | ||
} else { | ||
throw new Error('No email found with the correct subject.') | ||
} | ||
|
||
// Admin email assertions | ||
const adminEmail = results.find((msg) => msg.subject === 'Action required: process veritable invitation') | ||
const adminEmail = results.find( | ||
(msg) => msg.subject === 'Postal Code for Verification: Invitation from DIGITAL CATAPULT on Veritable' | ||
) | ||
if (adminEmail) { | ||
expect(adminEmail.to).to.have.lengthOf(1) | ||
expect(adminEmail.to[0]).to.contain('[email protected]') | ||
expect(adminEmail).to.deep.contain({ | ||
isRelayed: false, | ||
deliveredTo: '[email protected]', | ||
from: '[email protected]', | ||
to: ['[email protected]'], | ||
subject: 'Postal Code for Verification: Invitation from DIGITAL CATAPULT on Veritable', | ||
attachmentCount: 0, | ||
isUnread: true, | ||
}) | ||
} else { | ||
throw new Error('No email found with the subject "Action required: process veritable invitation".') | ||
throw new Error('No email found with the subject "Postal Code for Verification".') | ||
} | ||
|
||
resolve(true) | ||
|