From e6fe8fea479f772afcd3ef8c2d7072cd607a0660 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 08:21:19 +0000 Subject: [PATCH 1/3] Bump fast-check from 3.15.0 to 4.0.1 Bumps [fast-check](https://github.com/dubzzz/fast-check/tree/HEAD/packages/fast-check) from 3.15.0 to 4.0.1. - [Release notes](https://github.com/dubzzz/fast-check/releases) - [Changelog](https://github.com/dubzzz/fast-check/blob/main/packages/fast-check/CHANGELOG.md) - [Commits](https://github.com/dubzzz/fast-check/commits/v4.0.1/packages/fast-check) --- updated-dependencies: - dependency-name: fast-check dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 46 ++++++++++++++++++++++++++++++++++++---------- package.json | 2 +- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6d4fc0f0e8..6db81bc854 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "@types/uuid": "^10.0.0", "eslint": "^8.56.0", "eslint-config-next": "^15.0.1", - "fast-check": "^3.15.0", + "fast-check": "^4.0.1", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "prettier": "3.5.3", @@ -5004,9 +5004,9 @@ } }, "node_modules/fast-check": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.15.0.tgz", - "integrity": "sha512-iBz6c+EXL6+nI931x/sbZs1JYTZtLG6Cko0ouS8LRTikhDR7+wZk4TYzdRavlnByBs2G6+nuuJ7NYL9QplNt8Q==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-4.0.1.tgz", + "integrity": "sha512-Z91jcH02ySQBQlKrCIs3tKTEHdkzOqQhHW5Mg4aZRo4lbI39a28jrFlik6FaRUNzm823VDDTtAi5AEV6lZZprQ==", "dev": true, "funding": [ { @@ -5018,13 +5018,31 @@ "url": "https://opencollective.com/fast-check" } ], + "license": "MIT", "dependencies": { - "pure-rand": "^6.0.0" + "pure-rand": "^7.0.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=12.17.0" } }, + "node_modules/fast-check/node_modules/pure-rand": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-7.0.1.tgz", + "integrity": "sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -13752,12 +13770,20 @@ } }, "fast-check": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.15.0.tgz", - "integrity": "sha512-iBz6c+EXL6+nI931x/sbZs1JYTZtLG6Cko0ouS8LRTikhDR7+wZk4TYzdRavlnByBs2G6+nuuJ7NYL9QplNt8Q==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-4.0.1.tgz", + "integrity": "sha512-Z91jcH02ySQBQlKrCIs3tKTEHdkzOqQhHW5Mg4aZRo4lbI39a28jrFlik6FaRUNzm823VDDTtAi5AEV6lZZprQ==", "dev": true, "requires": { - "pure-rand": "^6.0.0" + "pure-rand": "^7.0.0" + }, + "dependencies": { + "pure-rand": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-7.0.1.tgz", + "integrity": "sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ==", + "dev": true + } } }, "fast-deep-equal": { diff --git a/package.json b/package.json index 29e054c01a..1fcd128d2d 100644 --- a/package.json +++ b/package.json @@ -186,7 +186,7 @@ "@types/uuid": "^10.0.0", "eslint": "^8.56.0", "eslint-config-next": "^15.0.1", - "fast-check": "^3.15.0", + "fast-check": "^4.0.1", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "prettier": "3.5.3", From d50afdf3ce8d07da8d314c49935082d1e4144e43 Mon Sep 17 00:00:00 2001 From: Nicolas Ayral Seydoux Date: Wed, 2 Apr 2025 10:24:08 +0200 Subject: [PATCH 2/3] Upgrade to latest API --- src/rdf.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rdf.test.ts b/src/rdf.test.ts index b4ec342194..ac4ea08149 100644 --- a/src/rdf.test.ts +++ b/src/rdf.test.ts @@ -91,7 +91,7 @@ describe("fromRdfJsDataset", () => { fcArbitraryLiteral, ); const fcBlankNode = fc - .asciiString() + .string() .map((asciiString) => DF.blankNode(asciiString)); const fcDefaultGraph = fc.constant(DF.defaultGraph()); const fcGraph = fc.oneof(fcDefaultGraph, fcNamedNode); From af3eede34986135dbd47d61ce78fa219e8998705 Mon Sep 17 00:00:00 2001 From: Pete Edwards Date: Tue, 13 May 2025 10:49:02 +0100 Subject: [PATCH 3/3] Replace deprecated function in test --- src/rdf.test.ts | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/src/rdf.test.ts b/src/rdf.test.ts index ac4ea08149..616e8253ce 100644 --- a/src/rdf.test.ts +++ b/src/rdf.test.ts @@ -600,9 +600,20 @@ describe("toRdfJsDataset", () => { fc.uniqueArray(fc.string(), { minLength: 1 }), ) .filter(isNotEmpty); + // Replaced deprecated hexaString with custom implementation for v4 + const hexaChars = "0123456789abcdef"; + const hexa = () => { + return fc.integer({ min: 0, max: 15 }).map( + (n) => hexaChars[n], + (c) => hexaChars.indexOf(c), + ); + }; + const hexaString = (constraints: fc.StringConstraints = {}) => + fc.string({ ...constraints, unit: hexa() }); + const fcLangStrings = fc .dictionary( - fc.hexaString({ minLength: 1 }).map((str) => str.toLowerCase()), + hexaString({ minLength: 1 }).map((str) => str.toLowerCase()), fc.uniqueArray(fc.string(), { minLength: 1 }), ) .filter(isNotEmpty); @@ -619,16 +630,28 @@ describe("toRdfJsDataset", () => { minLength: 1, }, ); + // withDeletedKeys option was removed in v4, achieve similar functionality with filter const fcObjects = fc - .record( - { - literals: fcLiterals, - langStrings: fcLangStrings, - namedNodes: fcNamedNodes, - // blankNodes: fcBlankNodes, - }, - { withDeletedKeys: true }, - ) + .record({ + literals: fcLiterals, + langStrings: fcLangStrings, + namedNodes: fcNamedNodes, + // blankNodes: fcBlankNodes, + }) + .map((obj) => { + // Randomly delete some keys to achieve similar behavior to withDeletedKeys + const keys = Object.keys(obj) as Array; + if (keys.length <= 1) return obj; // Keep at least one property + + const result = { ...obj }; + // Delete random keys with 50% chance for each + keys.forEach((key) => { + if (Math.random() < 0.5 && Object.keys(result).length > 1) { + delete result[key]; + } + }); + return result; + }) .filter(isNotEmpty); // Unfortunately I haven't figured out how to generate the nested blank node // structures with fast-check yet, so this does not generate those: