Skip to content

Commit

Permalink
[PRDP-258] Updated integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
svariant committed Nov 30, 2023
1 parent 7874e3e commit c0dfc50
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion integration-test/src/features/receipt_pdf_datastore.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ Feature: All about payment events consumed by Azure functions receipt-pdf-genera
And the receipt has not the status "INSERTED"
And the blob storage has the PDF document

Scenario: a biz event enqueued on receipts poison queue is stored on receipt-message-error datastore
Scenario: a biz event enqueued on receipts poison queue is stored on receipt-message-error datastore and the receipt status is updated to TO_REVIEW
Given a random biz event with id "receipt-generator-int-test-id-3" enqueued on receipts poison queue with poison retry "true"
When the biz event has been properly stored on receipt-message-error datastore after 20000 ms
Then the receipt-message-error datastore returns the error receipt
And the error receipt has the status "TO_REVIEW"
And the receipts datastore returns the updated receipt
And the receipt has the status "TO_REVIEW"

Scenario: a biz event stored on receipt-message-error is enqueued on receipt queue that trigger the PDF receipt generation
Given a receipt with id "receipt-generator-int-test-id-4" stored into receipt datastore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ Then('the receipt has not the status {string}', function (targetStatus) {
assert.notStrictEqual(this.responseToCheck.resources[0].status, targetStatus);
});

Then('the receipt has the status {string}', function (targetStatus) {
assert.strictEqual(this.responseToCheck.resources[0].status, targetStatus);
});

Then('the receipts datastore returns the updated receipt', function(){
this.responseToCheck = await getDocumentByIdFromReceiptsDatastore(this.eventId);
})

Then('the blob storage has the PDF document', async function () {
let blobExist = await receiptPDFExist(this.responseToCheck.resources[0].mdAttach.name);
assert.strictEqual(true, blobExist);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ async function deleteDocumentFromReceiptsDatastoreByEventId(eventId){
}

async function createDocumentInReceiptsDatastore(id) {
let event = createReceipt(id);
let receipt = createReceipt(id);
try {
return await receiptContainer.items.create(event);
return await receiptContainer.items.create(receipt);
} catch (err) {
console.log(err);
}
Expand Down

0 comments on commit c0dfc50

Please sign in to comment.