diff --git a/service/src/adapters/icons/adapters.icons.db.mongoose.ts b/service/src/adapters/icons/adapters.icons.db.mongoose.ts index dc6cd5408..c28bd52a6 100644 --- a/service/src/adapters/icons/adapters.icons.db.mongoose.ts +++ b/service/src/adapters/icons/adapters.icons.db.mongoose.ts @@ -128,7 +128,7 @@ export class MongooseStaticIconRepository extends BaseMongooseRepository { - let icon = await this.model.findById(id) + const icon = await this.model.findById(id) if (!icon) { return null } diff --git a/service/test/adapters/icons/adapters.icons.db.mongoose.test.ts b/service/test/adapters/icons/adapters.icons.db.mongoose.test.ts index 9fd21d2d7..dee5cee83 100644 --- a/service/test/adapters/icons/adapters.icons.db.mongoose.test.ts +++ b/service/test/adapters/icons/adapters.icons.db.mongoose.test.ts @@ -1,6 +1,6 @@ import { URL } from 'url' import { expect } from 'chai' -import _, { uniq, uniqueId } from 'lodash' +import _ from 'lodash' import { MongoMemoryServer } from 'mongodb-memory-server' import mongoose from 'mongoose' import uniqid from 'uniqid' @@ -10,6 +10,7 @@ import { MongooseStaticIconRepository, StaticIconDocument, StaticIconModel } fro import { EntityIdFactory, UrlResolutionError, UrlScheme } from '../../../lib/entities/entities.global' import { Readable } from 'stream' + interface TestUrlScheme extends UrlScheme { urlWithPath(path: string): URL } @@ -130,7 +131,6 @@ describe('static icon mongoose repository', function() { it('replaces icon properties for an existing source url when the content hash changes', async function() { const sourceUrl = new URL('mage:///test/replace.png') - const origAttrs: Required = { sourceUrl, imageType: 'raster', @@ -145,7 +145,7 @@ describe('static icon mongoose repository', function() { summary: 'replace me' } const updatedAttrs: Required = { - sourceUrl, + sourceUrl: new URL(sourceUrl.toString()), imageType: 'vector', sizeBytes: 1100, sizePixels: { width: 220, height: 220 }, @@ -688,7 +688,7 @@ describe('static icon mongoose repository', function() { tags: [] } scheme2LocalIcon = { - id: uniqueId(), + id: uniqid(), sourceUrl: scheme2Local.urlWithPath('test2.png'), registeredTimestamp: Date.now(), resolvedTimestamp: Date.now(), diff --git a/service/test/app/systemInfo/app.systemInfo.test.ts b/service/test/app/systemInfo/app.systemInfo.test.ts index 1ba41060a..d6b20bdeb 100644 --- a/service/test/app/systemInfo/app.systemInfo.test.ts +++ b/service/test/app/systemInfo/app.systemInfo.test.ts @@ -23,7 +23,6 @@ const mockEnvironmentInfo: EnvironmentInfo = { const mockDisclaimer = {}; const mockContactInfo = {}; -// Test utility function function requestBy( principal: string, params?: T diff --git a/service/test/init.test.ts b/service/test/init.test.ts index c787941c6..80cae854e 100644 --- a/service/test/init.test.ts +++ b/service/test/init.test.ts @@ -1,11 +1,24 @@ + +import url from 'url' + +/** + * This class works around issue https://github.com/nodejs/node/issues/48886, + * which was introduced in Node 18.17.0. + */ +url.URL = class Node_18_17_Issue_48886_URL extends url.URL { + constructor(input: string, base?: string | url.URL) { + super(input, base) + this.searchParams + } +} + declare module 'mocha' { namespace Mocha { interface MochaOptions {} } } - import chai, { Assertion } from 'chai' import asPromised from 'chai-as-promised'