Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 18.17 48886 url deep equal assertion #176

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion service/src/adapters/icons/adapters.icons.db.mongoose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class MongooseStaticIconRepository extends BaseMongooseRepository<StaticI
}

async loadContent(id: StaticIconId): Promise<[StaticIcon, NodeJS.ReadableStream] | null | UrlResolutionError> {
let icon = await this.model.findById(id)
const icon = await this.model.findById(id)
if (!icon) {
return null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
}
Expand Down Expand Up @@ -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<StaticIconStub> = {
sourceUrl,
imageType: 'raster',
Expand All @@ -145,7 +145,7 @@ describe('static icon mongoose repository', function() {
summary: 'replace me'
}
const updatedAttrs: Required<StaticIconStub> = {
sourceUrl,
sourceUrl: new URL(sourceUrl.toString()),
imageType: 'vector',
sizeBytes: 1100,
sizePixels: { width: 220, height: 220 },
Expand Down Expand Up @@ -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(),
Expand Down
1 change: 0 additions & 1 deletion service/test/app/systemInfo/app.systemInfo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const mockEnvironmentInfo: EnvironmentInfo = {
const mockDisclaimer = {};
const mockContactInfo = {};

// Test utility function
function requestBy<T extends object>(
principal: string,
params?: T
Expand Down
15 changes: 14 additions & 1 deletion service/test/init.test.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down