Skip to content

Commit

Permalink
[PRDP-318] format code
Browse files Browse the repository at this point in the history
  • Loading branch information
giomella committed Jan 17, 2024
1 parent ffc0626 commit ac77f6b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
const {get} = require("./common");
const { get } = require("./common");

const bizevents_service_host = process.env.BIZ_EVENTS_SERVICE_HOST;

function healthCheckInfo() {
return get(bizevents_service_host+`info`, {})
return get(bizevents_service_host + `info`, {})
}

function getOrganizationReceipt(organizationfiscalcode, iur, iuv) {
return get(bizevents_service_host+`organizations/${organizationfiscalcode}/receipts/${iur}/paymentoptions/${iuv}`, {})
return get(bizevents_service_host + `organizations/${organizationfiscalcode}/receipts/${iur}/paymentoptions/${iuv}`, {})
}

function getBizEventById(id) {
return get(bizevents_service_host+`events/${id}`, {})
return get(bizevents_service_host + `events/${id}`, {})
}

function getBizEventByOrgFiscalCodeAndIuv(organizationfiscalcode, iuv) {
return get(bizevents_service_host+`events/organizations/${organizationfiscalcode}/iuvs/${iuv}`, {})
return get(bizevents_service_host + `events/organizations/${organizationfiscalcode}/iuvs/${iuv}`, {})
}

function getTransactionListForUserWithFiscalCode(fiscalcode) {
return get(bizevents_service_host+`transactions?start=0&size=10`, {
return get(bizevents_service_host + `transactions?start=0&size=10`, {
"x-fiscal-code": fiscalcode
})
}

function getTransactionWithIdForUserWithFiscalCode(id, fiscalcode, isCart) {
return get(bizevents_service_host+`transactions/${id}?isCart=${isCart}`, {
return get(bizevents_service_host + `transactions/${id}?isCart=${isCart}`, {
"x-fiscal-code": fiscalcode
})
}

module.exports = {
healthCheckInfo,
healthCheckInfo,
getOrganizationReceipt,
getBizEventById,
getBizEventByOrgFiscalCodeAndIuv,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const assert = require('assert')
const {Given, When, Then, setDefaultTimeout, After} = require('@cucumber/cucumber')
const {getOrganizationReceipt, getBizEventById, getBizEventByOrgFiscalCodeAndIuv, getTransactionListForUserWithFiscalCode, getTransactionWithIdForUserWithFiscalCode} = require("./bizeventservice_client");
const {createDocument, deleteDocument} = require("./cosmosdb_client");
const {createEvent, makeId} = require("./common");
const {createDocumentInBizEventsDatastore, deleteDocumentFromBizEventsDatastore} = require("./biz_events_cosmosdb_client");
const { Given, When, Then, setDefaultTimeout, After } = require('@cucumber/cucumber')
const { getOrganizationReceipt, getBizEventById, getBizEventByOrgFiscalCodeAndIuv, getTransactionListForUserWithFiscalCode, getTransactionWithIdForUserWithFiscalCode } = require("./bizeventservice_client");
const { createDocument, deleteDocument } = require("./cosmosdb_client");
const { createEvent, makeId } = require("./common");
const { createDocumentInBizEventsDatastore, deleteDocumentFromBizEventsDatastore } = require("./biz_events_cosmosdb_client");

const BIZ_ID = "biz-event-service-int-test-transaction-";

Expand All @@ -16,14 +16,14 @@ setDefaultTimeout(360 * 1000);

// After each Scenario
After(async function () {
// remove event
if(bizEventList.length > 0){
for(let bizEvent of bizEventList){
await deleteDocumentFromBizEventsDatastore(bizEvent.id);
}
}

responseToCheck = null;
// remove event
if (bizEventList.length > 0) {
for (let bizEvent of bizEventList) {
await deleteDocumentFromBizEventsDatastore(bizEvent.id);
}
}

responseToCheck = null;
receipt = null;
bizEvent = null;
bizEventList = [];
Expand Down Expand Up @@ -87,14 +87,14 @@ Then('the details of the Biz-Event are returned to the operator with id {string}

Given('{int} Biz-Event with debtor fiscal code {string}', (numberOfEvents, debtorFiscalCode) => {
for (let i = 0; i < numberOfEvents; i++) {
bizEventList.push(createEvent(BIZ_ID + i + makeId(4), undefined, undefined, debtorFiscalCode))
}
bizEventList.push(createEvent(BIZ_ID + i + makeId(4), undefined, undefined, debtorFiscalCode))
}
})

Given('{int} Biz-Event with payer fiscal code {string}', (numberOfEvents, payerFiscalCode) => {
for (let i = 0; i < numberOfEvents; i++) {
bizEventList.push(createEvent(BIZ_ID + i + makeId(4), undefined, undefined, undefined, payerFiscalCode))
}
bizEventList.push(createEvent(BIZ_ID + i + makeId(4), undefined, undefined, undefined, payerFiscalCode))
}
})

Given('Save all on Cosmos DB', async () => {
Expand All @@ -112,24 +112,24 @@ When('the user with fiscal code {string} asks for its transactions', async (fisc
Then('the user gets the status code {int}', (status) => {
assert.strictEqual(responseToCheck.status, status);
})

Then('the user gets {int} transactions', (totalTransactions) => {
assert.strictEqual(responseToCheck.data.length, totalTransactions);
})

Given('{int} cart Biz-Event with transactionId {string}, debtor fiscal code {string} and amount {int}', (numberOfEvents, transactionId, debtorFiscalCode, amount) => {
for (let i = 0; i < numberOfEvents; i++) {
bizEventList.push(createEvent(i + makeId(10), transactionId, numberOfEvents, debtorFiscalCode, undefined, amount))
}
bizEventList.push(createEvent(i + makeId(10), transactionId, numberOfEvents, debtorFiscalCode, undefined, amount))
}
})

Then('one of the transactions is a cart with id {string} and amount {bigdecimal}', (transactionId, amount) => {
let found = false;
for (let transaction of responseToCheck.data) {
if (transaction.transactionId == transactionId) {
assert.strictEqual(transaction.amount, amount);
found = true;
}
assert.strictEqual(transaction.amount, amount);
found = true;
}
}
assert.strictEqual(found, true);
})
Expand Down

0 comments on commit ac77f6b

Please sign in to comment.