ldo tests fixed

main
jaxoncreed 2 years ago
parent 08649c5d7a
commit 3ec64611d7
  1. 2
      packages/ldo/example/example.ts
  2. 2
      packages/ldo/example/ldo/foafProfile.context.ts
  3. 4
      packages/ldo/package.json
  4. 10
      packages/ldo/src/LdoBuilder.ts
  5. 2
      packages/ldo/src/LdoDataset.ts
  6. 2
      packages/ldo/src/LdoDatasetFactory.ts
  7. 2
      packages/ldo/src/createLdoDataset.ts
  8. 1
      packages/ldo/src/index.ts
  9. 3
      packages/ldo/src/methods.ts
  10. 2
      packages/ldo/src/parseRdf.ts
  11. 6
      packages/ldo/src/util.ts
  12. 4
      packages/ldo/test/LdoDataset.test.ts
  13. 6
      packages/ldo/test/methods.test.ts

@ -1,4 +1,4 @@
import { parseRdf, startTransaction, toSparqlUpdate, toTurtle } from "../lib";
import { parseRdf, startTransaction, toSparqlUpdate, toTurtle } from "../src";
import { FoafProfileShapeType } from "./ldo/foafProfile.shapeTypes";
async function run() {

@ -1,4 +1,4 @@
import { ContextDefinition } from "jsonld";
import type { ContextDefinition } from "jsonld";
/**
* =============================================================================

@ -22,6 +22,8 @@
},
"homepage": "https://github.com/o-development/ldo#readme",
"devDependencies": {
"@ldo/rdf-utils": "^0.0.0",
"@rdfjs/types": "^1.0.1",
"@types/jest": "^27.0.3",
"@types/jsonld": "^1.5.6",
"@types/n3": "^1.10.4",
@ -35,8 +37,8 @@
"dependencies": {
"@ldo/dataset": "^0.0.0",
"@ldo/jsonld-dataset-proxy": "^0.0.0",
"@ldo/rdf-utils": "^0.0.0",
"@ldo/subscribable-dataset": "^0.0.0",
"@rdfjs/data-model": "^1.2.0",
"buffer": "^6.0.3",
"readable-stream": "^4.3.0"
},

@ -1,9 +1,7 @@
import type { GraphNode, QuadMatch, SubjectNode } from "@ldo/rdf-utils";
import type {
GraphType,
JsonldDatasetProxyBuilder,
QuadMatch,
SubjectType,
LanguageOrdering,
JsonldDatasetProxyBuilder,
} from "@ldo/jsonld-dataset-proxy";
import type { ShapeType } from "./ShapeType";
import type { LdoBase } from "./util";
@ -29,7 +27,7 @@ export class LdoBuilder<Type extends LdoBase> {
* Designates that all Linked Data Objects created should write to the
* specified graphs
*/
write(...graphs: (GraphType | string)[]): LdoBuilder<Type> {
write(...graphs: (GraphNode | string)[]): LdoBuilder<Type> {
return new LdoBuilder(
this.jsonldDatasetProxyBuilder.write(...normalizeNodeNames(graphs)),
this.shapeType,
@ -55,7 +53,7 @@ export class LdoBuilder<Type extends LdoBase> {
* Creates a Linked Data Object that matches the given subject
* @param subject The node to match
*/
fromSubject(subject: SubjectType | string): Type {
fromSubject(subject: SubjectNode | string): Type {
return this.jsonldDatasetProxyBuilder.fromSubject<Type>(
normalizeNodeName(subject),
);

@ -1,4 +1,4 @@
import type { Quad } from "@ldo/rdf-utils";
import type { Quad } from "@rdfjs/types";
import jsonldDatasetProxy from "@ldo/jsonld-dataset-proxy";
import { WrapperSubscribableDataset } from "@ldo/subscribable-dataset";
import { LdoBuilder } from "./LdoBuilder";

@ -1,4 +1,4 @@
import type { DatasetFactory, Dataset, Quad } from "@ldo/rdf-utils";
import type { DatasetFactory, Dataset, Quad } from "@rdfjs/types";
import { LdoDataset } from "./LdoDataset";
/**

@ -1,4 +1,4 @@
import type { Dataset, DatasetFactory, Quad } from "@ldo/rdf-utils";
import type { Dataset, DatasetFactory, Quad } from "@rdfjs/types";
import { createDataset } from "@ldo/dataset";
import { LdoDatasetFactory } from "./LdoDatasetFactory";

@ -6,4 +6,3 @@ export * from "./LdoBuilder";
export * from "./createLdoDataset";
import type { LdoBase as LdoBaseImport } from "./util";
export type LdoBase = LdoBaseImport;
export { datasetToString } from "./datasetConverters";

@ -8,7 +8,8 @@ import {
write as writeDependency,
} from "@ldo/jsonld-dataset-proxy";
import type { SubscribableDataset } from "@ldo/subscribable-dataset";
import type { WriterOptions, Dataset, Quad } from "@ldo/rdf-utils";
import type { WriterOptions } from "@ldo/rdf-utils";
import type { Dataset, Quad } from "@rdfjs/types";
import { changesToSparqlUpdate, datasetToString } from "@ldo/rdf-utils";
import type { LdoBase } from "./util";
import {

@ -1,4 +1,4 @@
import type { Dataset } from "@ldo/rdf-utils";
import type { Dataset } from "@rdfjs/types";
import type { JsonLdDocument } from "jsonld";
import type { ParserOptions } from "@ldo/rdf-utils";
import { createDatasetFromSerializedInput } from "@ldo/dataset";

@ -1,12 +1,12 @@
import { namedNode } from "@ldo/rdf-utils";
import type { Dataset } from "@ldo/rdf-utils";
import { namedNode } from "@rdfjs/data-model";
import type { Dataset, Quad } from "@rdfjs/types";
import type { ArrayProxy, SubjectProxy } from "@ldo/jsonld-dataset-proxy";
import {
getProxyFromObject,
_getUnderlyingDataset,
_proxyContext,
} from "@ldo/jsonld-dataset-proxy";
import type { Quad, AnyNode } from "@ldo/rdf-utils";
import type { AnyNode } from "@ldo/rdf-utils";
import type {
SubscribableDataset,
TransactionalDataset,

@ -1,4 +1,4 @@
import { literal, namedNode, quad } from "@ldo/rdf-utils";
import { literal, namedNode, quad } from "@rdfjs/data-model";
import { createDataset } from "@ldo/dataset";
import type { SolidProfileShape } from "./profileData";
import { ProfileShapeType } from "./profileData";
@ -27,7 +27,7 @@ describe("LdoDataset", () => {
);
profile.fn = "Diplo";
expect(await toTurtle(profile)).toBe(
'<https://example.com/person1#me> <http://www.w3.org/2006/vcard/ns#fn> "Diplo".\n',
'<https://example.com/person1#me> <http://www.w3.org/2006/vcard/ns#fn> "Diplo" .\n',
);
});

@ -1,4 +1,4 @@
import { namedNode } from "@ldo/rdf-utils";
import { namedNode } from "@rdfjs/data-model";
import type { SubjectProxy } from "@ldo/jsonld-dataset-proxy";
import {
getProxyFromObject,
@ -92,7 +92,7 @@ describe("methods", () => {
it("translates into turtle", async () => {
profile.name = "Captain of Coolness";
expect(await toTurtle(profile)).toBe(
'<https://example.com/item> <http://xmlns.com/foaf/0.1/name> "Captain of Coolness".\n',
'<https://example.com/item> <http://xmlns.com/foaf/0.1/name> "Captain of Coolness" .\n',
);
});
@ -106,7 +106,7 @@ describe("methods", () => {
it("uses the serialize method", async () => {
profile.name = "Captain of Coolness";
expect(await serialize(profile, { format: "Turtle" })).toBe(
'<https://example.com/item> <http://xmlns.com/foaf/0.1/name> "Captain of Coolness".\n',
'<https://example.com/item> <http://xmlns.com/foaf/0.1/name> "Captain of Coolness" .\n',
);
});

Loading…
Cancel
Save