Skip to content

Rely on workspace packages rather than direct file imports #12

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

Merged
merged 2 commits into from
Feb 7, 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
5 changes: 5 additions & 0 deletions .changeset/rude-camels-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@neo4j/graph-schema-utils": patch
---

Make internal dependencies rely on workspace rather than fs
3 changes: 0 additions & 3 deletions packages/graph-schema-utils/test/model/parse.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { strict as assert } from "node:assert";
import { fileURLToPath } from "url";
import path from "path";
import { readFile } from "../fs.utils.js";
import { describe, test } from "vitest";
import { model } from "../../src";

const __dirname = path.dirname(fileURLToPath(new URL(import.meta.url)));

describe("Parser tests", () => {
const fullSchema = readFile(
path.resolve(__dirname, "./test-schemas/full.json")
Expand Down
10 changes: 4 additions & 6 deletions packages/graph-schema-utils/test/model/serialize.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { strict as assert } from "node:assert";
import { fileURLToPath } from "url";
import path from "path";
import { readFile } from "../fs.utils.js";
import { describe, test } from "vitest";
import { model, validateSchema } from "../../src";
import { createRequire } from "module";

const __dirname = path.dirname(fileURLToPath(new URL(import.meta.url)));
const JSON_SCHEMA_FILE = path.resolve(
__dirname,
"../../../json-schema/json-schema.json"
const require = createRequire(import.meta.url);
const JSON_SCHEMA = JSON.stringify(
require("@neo4j/graph-json-schema/json-schema.json")
);
const JSON_SCHEMA = readFile(JSON_SCHEMA_FILE);

describe("Serializer tests", () => {
const fullSchema = readFile(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { strict as assert } from "node:assert";
import { fileURLToPath } from "url";
import path from "path";
import { SchemaValidationError, validateSchema } from "../../src/index.js";
import { readFile } from "../fs.utils.js";
import { describe, test } from "vitest";
import { createRequire } from "module";

const __dirname = path.dirname(fileURLToPath(new URL(import.meta.url)));
const JSON_SCHEMA_FILE = path.resolve(
__dirname,
"../../../json-schema/json-schema.json"
const require = createRequire(import.meta.url);
const JSON_SCHEMA = JSON.stringify(
require("@neo4j/graph-json-schema/json-schema.json")
);
const JSON_SCHEMA = readFile(JSON_SCHEMA_FILE);

// Validate type errors == schemas we expect NOT to pass
describe("Validate type errors", () => {
Expand Down
10 changes: 4 additions & 6 deletions packages/graph-schema-utils/test/validation/full.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { strict as assert } from "node:assert";
import { fileURLToPath } from "url";
import path from "path";
import { validateSchema } from "../../src/index.js";
import { readFile } from "../fs.utils.js";
import { describe, test } from "vitest";
import { createRequire } from "module";

const __dirname = path.dirname(fileURLToPath(new URL(import.meta.url)));
const JSON_SCHEMA_FILE = path.resolve(
__dirname,
"../../../json-schema/json-schema.json"
const require = createRequire(import.meta.url);
const JSON_SCHEMA = JSON.stringify(
require("@neo4j/graph-json-schema/json-schema.json")
);
const JSON_SCHEMA = readFile(JSON_SCHEMA_FILE);

// Happy path == schemas we expect to pass
describe("Full graph schema tests happy path tests", () => {
Expand Down
10 changes: 4 additions & 6 deletions packages/graph-schema-utils/test/validation/new-props.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { strict as assert } from "node:assert";
import { fileURLToPath } from "url";
import path from "path";
import { validateSchema } from "../../src/index.js";
import { readFile } from "../fs.utils.js";
import { describe, test } from "vitest";
import { createRequire } from "module";

const __dirname = path.dirname(fileURLToPath(new URL(import.meta.url)));
const JSON_SCHEMA_FILE = path.resolve(
__dirname,
"../../../json-schema/json-schema.json"
const require = createRequire(import.meta.url);
const JSON_SCHEMA = JSON.stringify(
require("@neo4j/graph-json-schema/json-schema.json")
);
const JSON_SCHEMA = readFile(JSON_SCHEMA_FILE);

describe("Props", () => {
test("New pros", () => {
Expand Down
13 changes: 5 additions & 8 deletions packages/graph-schema-utils/test/validation/root-schema.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { strict as assert } from "node:assert";
import { fileURLToPath } from "url";
import path from "path";
import { SchemaValidationError, validateSchema } from "../../src/index.js";
import { validateSchema } from "../../src/index.js";
import { readFile } from "../fs.utils.js";
import { describe, test } from "vitest";
import { createRequire } from "module";

const __dirname = path.dirname(fileURLToPath(new URL(import.meta.url)));
const JSON_SCHEMA_FILE = path.resolve(
__dirname,
"../../../json-schema/json-schema.json"
const require = createRequire(import.meta.url);
const JSON_SCHEMA = JSON.stringify(
require("@neo4j/graph-json-schema/json-schema.json")
);
const JSON_SCHEMA = readFile(JSON_SCHEMA_FILE);

// Validate root schema, allowing root schema.
describe("Validate that root schema is allowed ", () => {
Expand All @@ -21,6 +19,5 @@ describe("Validate that root schema is allowed ", () => {

const valid = validateSchema(JSON_SCHEMA, allowRootSchema);
assert.strictEqual(valid, true);

});
});
9 changes: 4 additions & 5 deletions packages/graph-schema-utils/test/validation/simple.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import path from "path";
import { validateSchema } from "../../src/index.js";
import { readFile } from "../fs.utils.js";
import { describe, test } from "vitest";
import { createRequire } from "module";

const __dirname = path.dirname(fileURLToPath(new URL(import.meta.url)));
const JSON_SCHEMA_FILE = path.resolve(
__dirname,
"../../../json-schema/json-schema.json"
const require = createRequire(import.meta.url);
const JSON_SCHEMA = JSON.stringify(
require("@neo4j/graph-json-schema/json-schema.json")
);
const JSON_SCHEMA = readFile(JSON_SCHEMA_FILE);

// Happy path == schemas we expect to pass
describe("Simple happy path tests", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import { validateSchema } from "../../src/index.js";
import { readFile } from "../fs.utils.js";
import { describe, test } from "vitest";
import { InputTypeError } from "../../src/validation.js";
import { createRequire } from "module";

const __dirname = path.dirname(fileURLToPath(new URL(import.meta.url)));
const JSON_SCHEMA_FILE = path.resolve(
__dirname,
"../../../json-schema/json-schema.json"
const require = createRequire(import.meta.url);
const JSON_SCHEMA = JSON.stringify(
require("@neo4j/graph-json-schema/json-schema.json")
);
const JSON_SCHEMA = readFile(JSON_SCHEMA_FILE);

describe("Validate if JSON-documen is a string", () => {
const NON_STRING = 11;
Expand Down