From 693c09bc070edc42d83b1ed1a295a43b92bbac61 Mon Sep 17 00:00:00 2001 From: Alan Cruikshanks Date: Fri, 8 Sep 2023 14:58:30 +0100 Subject: [PATCH 1/4] Move UUID generation to a single place MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/DEFRA/water-abstraction-team/issues/96 There are a number of places in [water-abstraction-system](https://github.com/DEFRA/water-abstraction-system) where we need to generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier). This is what the records in the DB use for their primary keys. We generate them in tests, for performance reasons (reduce hits on the DB) or simply because the previous team forgot to set the table to automatically generate them! You have to `require()` the module and then it's a one-liner to generate the method. So, moving it to our own thing didn't seem necessary. But there is some config you need to apply, and we have duplicated that in a number of places. Who knows where a new dev will encounter `randomUUID({ disableEntropyCache: true })` for the first time! 😆 Admittedly, it's borderline whether there is value in doing this. But we've come to the conclusion we should. From 35ad405018b2f7eb05997b34fcea49e27072c2f6 Mon Sep 17 00:00:00 2001 From: Alan Cruikshanks Date: Fri, 8 Sep 2023 15:43:33 +0100 Subject: [PATCH 2/4] Commit changes --- app/lib/general.lib.js | 23 +++++++++++++ ...enerate-billing-invoice-licence.service.js | 4 +-- .../generate-billing-invoice.service.js | 4 +-- .../generate-billing-transactions.service.js | 25 ++------------ .../supplementary/reissue-invoice.service.js | 5 +-- .../reverse-billing-transactions.service.js | 13 ++------ db/seeds/01-users.js | 5 +-- .../reissue-invoice.service.test.js | 33 +++++++++---------- .../reissue-invoices.service.test.js | 11 +++---- test/support/helpers/idm/group.helper.js | 5 ++- test/support/helpers/idm/user-group.helper.js | 5 ++- test/support/helpers/idm/user-role.helper.js | 5 ++- test/support/helpers/returns/line.helper.js | 5 ++- .../support/helpers/returns/version.helper.js | 5 ++- 14 files changed, 69 insertions(+), 79 deletions(-) diff --git a/app/lib/general.lib.js b/app/lib/general.lib.js index 5066dc2d46..195174711b 100644 --- a/app/lib/general.lib.js +++ b/app/lib/general.lib.js @@ -5,6 +5,28 @@ * @module GeneralLib */ +const { randomUUID } = require('crypto') + +/** + * Generate a Universally Unique Identifier (UUID) + * + * The service uses these as the IDs for most records in the DB. Most tables will automatically generate them when + * the record is created but not all do. There are also times when it is either more performant, simpler, or both for + * us to generate the ID before inserting a new record. For example, we can pass the generated ID to child records to + * set the foreign key relationship. + * + * NOTE: We set `disableEntropyCache` to `false` as normally, for performance reasons node caches enough random data to + * generate up to 128 UUIDs. We disable this as we may need to generate more than this and the performance hit in + * disabling this cache is a rounding error in comparison to the rest of the process. + * + * https://nodejs.org/api/crypto.html#cryptorandomuuidoptions + * + * @returns {String} a randomly generated UUID + */ +function generateUUID () { + return randomUUID({ disableEntropyCache: true }) +} + /** * Returns the current date and time as an ISO string * @@ -21,5 +43,6 @@ function timestampForPostgres () { } module.exports = { + generateUUID, timestampForPostgres } diff --git a/app/services/billing/supplementary/generate-billing-invoice-licence.service.js b/app/services/billing/supplementary/generate-billing-invoice-licence.service.js index 19d7642914..23795063fa 100644 --- a/app/services/billing/supplementary/generate-billing-invoice-licence.service.js +++ b/app/services/billing/supplementary/generate-billing-invoice-licence.service.js @@ -5,7 +5,7 @@ * @module GenerateBillingInvoiceLicenceService */ -const { randomUUID } = require('crypto') +const { generateUUID } = require('../../../lib/general.lib.js') /** * Return a billing invoice licence object ready for persisting @@ -19,7 +19,7 @@ const { randomUUID } = require('crypto') function go (billingInvoiceId, licence) { const billingInvoiceLicence = { billingInvoiceId, - billingInvoiceLicenceId: randomUUID({ disableEntropyCache: true }), + billingInvoiceLicenceId: generateUUID(), licenceRef: licence.licenceRef, licenceId: licence.licenceId } diff --git a/app/services/billing/supplementary/generate-billing-invoice.service.js b/app/services/billing/supplementary/generate-billing-invoice.service.js index dafec846b7..5cc56caa31 100644 --- a/app/services/billing/supplementary/generate-billing-invoice.service.js +++ b/app/services/billing/supplementary/generate-billing-invoice.service.js @@ -5,7 +5,7 @@ * @module GenerateBillingInvoiceService */ -const { randomUUID } = require('crypto') +const { generateUUID } = require('../../../lib/general.lib.js') /** * Return a billing invoice object ready for persisting @@ -21,7 +21,7 @@ function go (invoiceAccount, billingBatchId, financialYearEnding) { billingBatchId, financialYearEnding, invoiceAccountId: invoiceAccount.invoiceAccountId, - billingInvoiceId: randomUUID({ disableEntropyCache: true }), + billingInvoiceId: generateUUID(), address: {}, // Address is set to an empty object for SROC billing invoices invoiceAccountNumber: invoiceAccount.invoiceAccountNumber, isCredit: false diff --git a/app/services/billing/supplementary/generate-billing-transactions.service.js b/app/services/billing/supplementary/generate-billing-transactions.service.js index 0ae02b492f..683268c58d 100644 --- a/app/services/billing/supplementary/generate-billing-transactions.service.js +++ b/app/services/billing/supplementary/generate-billing-transactions.service.js @@ -5,7 +5,7 @@ * @module GenerateBillingTransactionsService */ -const { randomUUID } = require('crypto') +const { generateUUID } = require('../../../lib/general.lib.js') const CalculateAuthorisedAndBillableDaysServiceService = require('./calculate-authorised-and-billable-days.service.js') @@ -46,7 +46,7 @@ function go (chargeElement, billingPeriod, chargePeriod, isNewLicence, isWaterUn } const standardTransaction = _standardTransaction( - _generateUuid(), + generateUUID(), authorisedDays, billableDays, chargeElement, @@ -57,7 +57,7 @@ function go (chargeElement, billingPeriod, chargePeriod, isNewLicence, isWaterUn billingTransactions.push(standardTransaction) if (!isWaterUndertaker) { - const compensationTransaction = _compensationTransaction(_generateUuid(), standardTransaction) + const compensationTransaction = _compensationTransaction(generateUUID(), standardTransaction) billingTransactions.push(compensationTransaction) } @@ -86,25 +86,6 @@ function _description (chargeElement) { return `Two-part tariff basic water abstraction charge: ${chargeElement.description}` } -/** - * Return a unique UUID to be used as an ID - * - * We only intend to persist the transaction and associated billing invoice and licence if there is something to bill! - * But we have to provide the charging module with the ID of our transaction so it can protect against duplicates. - * - * So, we generate our transaction ID's in the code and avoid having to send a DB insert just to get back an ID to use. - * - * @returns {string} a unique UUID - */ -function _generateUuid () { - // We set `disableEntropyCache` to `false` as normally, for performance reasons node caches enough random data to - // generate up to 128 UUIDs. We disable this as we may need to generate more than this and the performance hit in - // disabling this cache is a rounding error in comparison to the rest of the process. - // - // https://nodejs.org/api/crypto.html#cryptorandomuuidoptions - return randomUUID({ disableEntropyCache: true }) -} - /** * Returns a json representation of all charge purposes in a charge element */ diff --git a/app/services/billing/supplementary/reissue-invoice.service.js b/app/services/billing/supplementary/reissue-invoice.service.js index ad7d81a44c..c64a50f617 100644 --- a/app/services/billing/supplementary/reissue-invoice.service.js +++ b/app/services/billing/supplementary/reissue-invoice.service.js @@ -4,7 +4,8 @@ * Handles the reissuing of a single invoice * @module ReissueInvoiceService */ -const { randomUUID } = require('crypto') + +const { generateUUID } = require('../../../lib/general.lib.js') const ChargingModuleBillRunStatusService = require('../../charging-module/bill-run-status.service.js') const ChargingModuleReissueInvoiceService = require('../../charging-module/reissue-invoice.service.js') @@ -152,7 +153,7 @@ async function _pauseUntilNotPending (billingBatchExternalId) { function _generateTransaction (chargingModuleReissueTransaction, sourceTransaction, billingInvoiceLicenceId) { return { ...sourceTransaction, - billingTransactionId: randomUUID({ disableEntropyCache: true }), + billingTransactionId: generateUUID(), externalId: chargingModuleReissueTransaction.id, isCredit: chargingModuleReissueTransaction.credit, netAmount: _determineSignOfNetAmount( diff --git a/app/services/billing/supplementary/reverse-billing-transactions.service.js b/app/services/billing/supplementary/reverse-billing-transactions.service.js index 6b3dd417ae..fd597e58cb 100644 --- a/app/services/billing/supplementary/reverse-billing-transactions.service.js +++ b/app/services/billing/supplementary/reverse-billing-transactions.service.js @@ -5,7 +5,7 @@ * @module ReverseBillingTransactionsService */ -const { randomUUID } = require('crypto') +const { generateUUID } = require('../../../lib/general.lib.js') /** * Takes an array of transactions and returns an array of transactions which will reverse them. @@ -44,7 +44,7 @@ function _reverseTransactions (transactions, billingInvoiceLicence) { return { ...propertiesToKeep, - billingTransactionId: _generateUuid(), + billingTransactionId: generateUUID(), billingInvoiceLicenceId: billingInvoiceLicence.billingInvoiceLicenceId, isCredit: true, status: 'candidate', @@ -57,15 +57,6 @@ function _reverseTransactions (transactions, billingInvoiceLicence) { }) } -function _generateUuid () { - // We set `disableEntropyCache` to `false` as normally, for performance reasons node caches enough random data to - // generate up to 128 UUIDs. We disable this as we may need to generate more than this and the performance hit in - // disabling this cache is a rounding error in comparison to the rest of the process. - // - // https://nodejs.org/api/crypto.html#cryptorandomuuidoptions - return randomUUID({ disableEntropyCache: true }) -} - module.exports = { go } diff --git a/db/seeds/01-users.js b/db/seeds/01-users.js index ed6462ac03..f7d6e738bc 100644 --- a/db/seeds/01-users.js +++ b/db/seeds/01-users.js @@ -1,7 +1,8 @@ 'use strict' const bcrypt = require('bcryptjs') -const { randomUUID } = require('crypto') + +const { generateUUID } = require('../../app/lib/general.lib.js') const DatabaseConfig = require('../../config/database.config.js') @@ -107,7 +108,7 @@ async function _insertUserGroupsWhereNotExists (knex) { if (!existingUserGroup) { await knex('idm.userGroups') .insert({ - userGroupId: randomUUID({ disableEntropyCache: true }), + userGroupId: generateUUID(), userId: seedUser.userId, groupId: seedUser.groupId }) diff --git a/test/services/billing/supplementary/reissue-invoice.service.test.js b/test/services/billing/supplementary/reissue-invoice.service.test.js index e606015015..d10889acf4 100644 --- a/test/services/billing/supplementary/reissue-invoice.service.test.js +++ b/test/services/billing/supplementary/reissue-invoice.service.test.js @@ -8,13 +8,12 @@ const Sinon = require('sinon') const { describe, it, beforeEach, afterEach } = exports.lab = Lab.script() const { expect } = Code -const { randomUUID } = require('crypto') - // Test helpers const BillingInvoiceHelper = require('../../../support/helpers/water/billing-invoice.helper.js') const BillingInvoiceLicenceHelper = require('../../../support/helpers/water/billing-invoice-licence.helper.js') const BillingTransactionHelper = require('../../../support/helpers/water/billing-transaction.helper.js') const DatabaseHelper = require('../../../support/helpers/database.helper.js') +const { generateUUID } = require('../../../../app/lib/general.lib.js') // Things we need to stub const ChargingModuleBillRunStatusService = require('../../../../app/services/charging-module/bill-run-status.service.js') @@ -24,15 +23,15 @@ const ChargingModuleViewInvoiceService = require('../../../../app/services/charg // Thing under test const ReissueInvoiceService = require('../../../../app/services/billing/supplementary/reissue-invoice.service.js') -const ORIGINAL_BILLING_BATCH_EXTERNAL_ID = randomUUID({ disableEntropyCache: true }) -const INVOICE_EXTERNAL_ID = randomUUID({ disableEntropyCache: true }) -const INVOICE_LICENCE_1_TRANSACTION_ID = randomUUID({ disableEntropyCache: true }) -const INVOICE_LICENCE_2_TRANSACTION_ID = randomUUID({ disableEntropyCache: true }) +const ORIGINAL_BILLING_BATCH_EXTERNAL_ID = generateUUID() +const INVOICE_EXTERNAL_ID = generateUUID() +const INVOICE_LICENCE_1_TRANSACTION_ID = generateUUID() +const INVOICE_LICENCE_2_TRANSACTION_ID = generateUUID() const CHARGING_MODULE_REISSUE_INVOICE_RESPONSE = { invoices: [ - { id: randomUUID({ disableEntropyCache: true }), rebilledType: 'C' }, - { id: randomUUID({ disableEntropyCache: true }), rebilledType: 'R' } + { id: generateUUID(), rebilledType: 'C' }, + { id: generateUUID(), rebilledType: 'R' } ] } @@ -48,12 +47,12 @@ const CHARGING_MODULE_VIEW_INVOICE_CREDIT_RESPONSE = { creditLineValue: 2000, licences: [ { - id: randomUUID({ disableEntropyCache: true }), + id: generateUUID(), licenceNumber: 'INVOICE_LICENCE_1', transactions: [_generateCMTransaction(true, INVOICE_LICENCE_1_TRANSACTION_ID)] }, { - id: randomUUID({ disableEntropyCache: true }), + id: generateUUID(), licenceNumber: 'INVOICE_LICENCE_2', transactions: [_generateCMTransaction(true, INVOICE_LICENCE_2_TRANSACTION_ID)] } @@ -73,12 +72,12 @@ const CHARGING_MODULE_VIEW_INVOICE_REISSUE_RESPONSE = { creditLineValue: 0, licences: [ { - id: randomUUID({ disableEntropyCache: true }), + id: generateUUID(), licenceNumber: 'INVOICE_LICENCE_1', transactions: [_generateCMTransaction(false, INVOICE_LICENCE_1_TRANSACTION_ID)] }, { - id: randomUUID({ disableEntropyCache: true }), + id: generateUUID(), licenceNumber: 'INVOICE_LICENCE_2', transactions: [_generateCMTransaction(false, INVOICE_LICENCE_2_TRANSACTION_ID)] } @@ -93,7 +92,7 @@ describe('Reissue invoice service', () => { beforeEach(async () => { await DatabaseHelper.clean() - reissueBillingBatch = { externalId: randomUUID({ disableEntropyCache: true }) } + reissueBillingBatch = { externalId: generateUUID() } Sinon.stub(ChargingModuleReissueInvoiceService, 'go') .withArgs(reissueBillingBatch.externalId, INVOICE_EXTERNAL_ID) @@ -131,12 +130,12 @@ describe('Reissue invoice service', () => { const sourceInvoiceLicences = await Promise.all([ BillingInvoiceLicenceHelper.add({ billingInvoiceId: sourceInvoice.billingInvoiceId, - licenceId: randomUUID({ disableEntropyCache: true }), + licenceId: generateUUID(), licenceRef: 'INVOICE_LICENCE_1' }), BillingInvoiceLicenceHelper.add({ billingInvoiceId: sourceInvoice.billingInvoiceId, - licenceId: randomUUID({ disableEntropyCache: true }), + licenceId: generateUUID(), licenceRef: 'INVOICE_LICENCE_2' }) ]) @@ -194,7 +193,7 @@ describe('Reissue invoice service', () => { }) it("to the existing value if it's populated", async () => { - const ORIGINAL_BILLING_INVOICE_ID = randomUUID({ disableEntropyCache: true }) + const ORIGINAL_BILLING_INVOICE_ID = generateUUID() await sourceInvoice.$query().patch({ originalBillingInvoiceId: ORIGINAL_BILLING_INVOICE_ID }) await ReissueInvoiceService.go(sourceInvoice, reissueBillingBatch) @@ -328,7 +327,7 @@ describe('Reissue invoice service', () => { function _generateCMTransaction (credit, rebilledTransactionId) { return { - id: randomUUID({ disableEntropyCache: true }), + id: generateUUID(), chargeValue: 1000, credit, rebilledTransactionId diff --git a/test/services/billing/supplementary/reissue-invoices.service.test.js b/test/services/billing/supplementary/reissue-invoices.service.test.js index 0f9da9753d..fad0660ddd 100644 --- a/test/services/billing/supplementary/reissue-invoices.service.test.js +++ b/test/services/billing/supplementary/reissue-invoices.service.test.js @@ -8,8 +8,6 @@ const Sinon = require('sinon') const { describe, it, beforeEach, afterEach } = exports.lab = Lab.script() const { expect } = Code -const { randomUUID } = require('crypto') - // Test helpers const BillingInvoiceHelper = require('../../../support/helpers/water/billing-invoice.helper.js') const BillingInvoiceModel = require('../../../../app/models/water/billing-invoice.model.js') @@ -18,6 +16,7 @@ const BillingInvoiceLicenceModel = require('../../../../app/models/water/billing const BillingTransactionHelper = require('../../../support/helpers/water/billing-transaction.helper.js') const BillingTransactionModel = require('../../../../app/models/water/billing-transaction.model.js') const DatabaseHelper = require('../../../support/helpers/database.helper.js') +const { generateUUID } = require('../../../../app/lib/general.lib.js') // Things we need to stub const LegacyRequestLib = require('../../../../app/lib/legacy-request.lib.js') @@ -29,7 +28,7 @@ const ReissueInvoicesService = require('../../../../app/services/billing/supplem describe('Reissue invoices service', () => { let notifierStub - const reissueBillingBatch = { regionId: randomUUID({ disableEntropyCache: true }) } + const reissueBillingBatch = { regionId: generateUUID() } beforeEach(async () => { await DatabaseHelper.clean() @@ -65,9 +64,9 @@ describe('Reissue invoices service', () => { beforeEach(async () => { // Three dummy invoices to ensure we iterate 3x Sinon.stub(FetchInvoicesToBeReissuedService, 'go').resolves([ - { id: randomUUID({ disableEntropyCache: true }) }, - { id: randomUUID({ disableEntropyCache: true }) }, - { id: randomUUID({ disableEntropyCache: true }) } + { id: generateUUID() }, + { id: generateUUID() }, + { id: generateUUID() } ]) // This stub will result in one new invoice, invoice licence and transaction for each dummy invoice diff --git a/test/support/helpers/idm/group.helper.js b/test/support/helpers/idm/group.helper.js index bf4c42269c..5e50bb419d 100644 --- a/test/support/helpers/idm/group.helper.js +++ b/test/support/helpers/idm/group.helper.js @@ -4,8 +4,7 @@ * @module GroupHelper */ -const { randomUUID } = require('crypto') - +const { generateUUID } = require('../../../../app/lib/general.lib.js') const GroupModel = require('../../../../app/models/idm/group.model.js') /** @@ -40,7 +39,7 @@ function add (data = {}) { function defaults (data = {}) { const defaults = { // We create a random uuid as the id is NOT generated by the db, unlike most other tables - groupId: randomUUID({ disableEntropyCache: true }), + groupId: generateUUID(), application: 'water_admin', group: 'wirs', description: 'Waste Industry Regulatory Services' diff --git a/test/support/helpers/idm/user-group.helper.js b/test/support/helpers/idm/user-group.helper.js index 40b68907b9..5e5eed7ae0 100644 --- a/test/support/helpers/idm/user-group.helper.js +++ b/test/support/helpers/idm/user-group.helper.js @@ -4,8 +4,7 @@ * @module UserGroupHelper */ -const { randomUUID } = require('crypto') - +const { generateUUID } = require('../../../../app/lib/general.lib.js') const UserGroupModel = require('../../../../app/models/idm/user-group.model.js') /** @@ -39,7 +38,7 @@ function add (data = {}) { function defaults (data = {}) { const defaults = { // We create a random uuid as the id is NOT generated by the db, unlike most other tables - userGroupId: randomUUID({ disableEntropyCache: true }), + userGroupId: generateUUID(), userId: 100001, groupId: 'e814fc07-e6e3-4a50-8699-9ede17690674' } diff --git a/test/support/helpers/idm/user-role.helper.js b/test/support/helpers/idm/user-role.helper.js index c761975b74..3c5077232f 100644 --- a/test/support/helpers/idm/user-role.helper.js +++ b/test/support/helpers/idm/user-role.helper.js @@ -4,8 +4,7 @@ * @module UserRoleHelper */ -const { randomUUID } = require('crypto') - +const { generateUUID } = require('../../../../app/lib/general.lib.js') const UserRoleModel = require('../../../../app/models/idm/user-role.model.js') /** @@ -39,7 +38,7 @@ function add (data = {}) { function defaults (data = {}) { const defaults = { // We create a random uuid as the id is NOT generated by the db, unlike most other tables - userRoleId: randomUUID({ disableEntropyCache: true }), + userRoleId: generateUUID(), userId: 100001, roleId: '66b54ff8-edec-417a-8c8b-48d98aad3843' } diff --git a/test/support/helpers/returns/line.helper.js b/test/support/helpers/returns/line.helper.js index eb0ca7a9cd..f82f1f4043 100644 --- a/test/support/helpers/returns/line.helper.js +++ b/test/support/helpers/returns/line.helper.js @@ -4,8 +4,7 @@ * @module LineHelper */ -const { randomUUID } = require('crypto') - +const { generateUUID } = require('../../../../app/lib/general.lib.js') const LineModel = require('../../../../app/models/returns/line.model.js') /** @@ -48,7 +47,7 @@ function add (data = {}) { */ function defaults (data = {}) { const defaults = { - lineId: randomUUID({ disableEntropyCache: true }), + lineId: generateUUID(), versionId: '8ca74383-08fd-4ca8-93f0-21c21247cb22', substance: 'water', quantity: 4380, diff --git a/test/support/helpers/returns/version.helper.js b/test/support/helpers/returns/version.helper.js index ca50528919..016d3da2ac 100644 --- a/test/support/helpers/returns/version.helper.js +++ b/test/support/helpers/returns/version.helper.js @@ -4,8 +4,7 @@ * @module VersionHelper */ -const { randomUUID } = require('crypto') - +const { generateUUID } = require('../../../../app/lib/general.lib.js') const VersionModel = require('../../../../app/models/returns/version.model.js') /** @@ -45,7 +44,7 @@ function add (data = {}) { */ function defaults (data = {}) { const defaults = { - versionId: randomUUID({ disableEntropyCache: true }), + versionId: generateUUID(), returnId: 'v1:2:03/28/78/0033:10025289:2021-11-01:2022-10-31', userId: 'admin-internal@wrls.gov.uk', userType: 'internal', From c1fa74b8089a9fc43b9d270cca95f776537d0765 Mon Sep 17 00:00:00 2001 From: Alan Cruikshanks Date: Fri, 8 Sep 2023 15:48:54 +0100 Subject: [PATCH 3/4] Add a test --- test/lib/general.lib.test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/lib/general.lib.test.js b/test/lib/general.lib.test.js index 5aa0cd5fc1..fbb62c0682 100644 --- a/test/lib/general.lib.test.js +++ b/test/lib/general.lib.test.js @@ -12,6 +12,21 @@ const { expect } = Code const GeneralLib = require('../../app/lib/general.lib.js') describe('RequestLib', () => { + describe('#generateUUID', () => { + // NOTE: generateUUID() only calls crypton.randomUUID(); it does nothing else. So, there is nothing really to test + // and certainly, testing the UUID is really unique is beyond the scope of this project! But this test at least + // serves as documentation and means no one will get confused by the lack of a test :-) + it('returns a Universally unique identifier (UUID)', () => { + const uuid1 = GeneralLib.generateUUID() + const uuid2 = GeneralLib.generateUUID() + const uuid3 = GeneralLib.generateUUID() + + expect(uuid1).not.to.equal(uuid2) + expect(uuid1).not.to.equal(uuid3) + expect(uuid2).not.to.equal(uuid3) + }) + }) + describe('#timestampForPostgres', () => { let clock let testDate From daa5be18f9a9d662ffab376f7118a41f853fdeef Mon Sep 17 00:00:00 2001 From: Alan Cruikshanks Date: Fri, 8 Sep 2023 16:00:49 +0100 Subject: [PATCH 4/4] Typo --- test/lib/general.lib.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lib/general.lib.test.js b/test/lib/general.lib.test.js index fbb62c0682..ba58b40656 100644 --- a/test/lib/general.lib.test.js +++ b/test/lib/general.lib.test.js @@ -13,7 +13,7 @@ const GeneralLib = require('../../app/lib/general.lib.js') describe('RequestLib', () => { describe('#generateUUID', () => { - // NOTE: generateUUID() only calls crypton.randomUUID(); it does nothing else. So, there is nothing really to test + // NOTE: generateUUID() only calls crypto.randomUUID(); it does nothing else. So, there is nothing really to test // and certainly, testing the UUID is really unique is beyond the scope of this project! But this test at least // serves as documentation and means no one will get confused by the lack of a test :-) it('returns a Universally unique identifier (UUID)', () => {