Skip to content

Commit

Permalink
Merge pull request #278 from neo4j/replace-toThrowError
Browse files Browse the repository at this point in the history
Replace deprecated toThrowError in favour of toThrow
  • Loading branch information
angrykoala committed Jan 19, 2024
2 parents 3889edd + 0074de3 commit 0d534b5
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Environment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe("Environment", () => {
expect(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
environment.compile({} as any);
}).toThrowError("Can't compile. Passing a non Cypher Builder element to env.compile");
}).toThrow("Can't compile. Passing a non Cypher Builder element to env.compile");
});

describe("prefix", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/clauses/Call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ describe("CypherBuilder Call", () => {
const clause = new Cypher.Call(matchClause).innerWith(node);
expect(() => {
clause.innerWith(node);
}).toThrowError("Call import already set");
}).toThrow("Call import already set");
});

test("CALL with external with", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/clauses/Unwind.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ UNWIND var1 AS var2"

expect(() => {
unwindQuery.unwind([variable, new Cypher.Variable()]);
}).toThrowError("Invalid Unwind statement");
}).toThrow("Invalid Unwind statement");
});
});
4 changes: 2 additions & 2 deletions src/expressions/Case.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* limitations under the License.
*/

import { TestClause } from "../utils/TestClause";
import Cypher from "..";
import { TestClause } from "../utils/TestClause";

describe("Case", () => {
test("case ... then ... else with comparator", () => {
Expand Down Expand Up @@ -76,6 +76,6 @@ describe("Case", () => {

expect(() => {
new TestClause(caseClause).build();
}).toThrowError("Cannot generate CASE ... WHEN statement without THEN");
}).toThrow("Cannot generate CASE ... WHEN statement without THEN");
});
});
4 changes: 2 additions & 2 deletions src/expressions/functions/aggregation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* limitations under the License.
*/

import { TestClause } from "../../utils/TestClause";
import Cypher from "../..";
import { TestClause } from "../../utils/TestClause";

describe("Aggregation Functions", () => {
describe.each(["count", "min", "max", "avg", "sum", "collect", "stDev", "stDevP"] as const)("%s", (value) => {
Expand Down Expand Up @@ -54,7 +54,7 @@ describe("Aggregation Functions", () => {
test("count(*) with distinct fails", () => {
expect(() => {
Cypher.count("*").distinct();
}).toThrowError("count(*) is not supported with DISTINCT");
}).toThrow("count(*) is not supported with DISTINCT");
});

describe.each(["percentileCont", "percentileDisc"] as const)("%s", (value) => {
Expand Down
4 changes: 2 additions & 2 deletions src/expressions/list/ListComprehension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe("List comprehension", () => {

expect(() => {
new Cypher.ListComprehension(variable, exprVariable).in(exprVariable);
}).toThrowError("Cannot set 2 lists in list comprehension IN");
}).toThrow("Cannot set 2 lists in list comprehension IN");
});

it("Fails to build if no expression is set", () => {
Expand All @@ -106,6 +106,6 @@ describe("List comprehension", () => {
const listComprehension = new Cypher.ListComprehension(variable);
expect(() => {
new TestClause(listComprehension).build();
}).toThrowError("List Comprehension needs a source list after IN");
}).toThrow("List Comprehension needs a source list after IN");
});
});
4 changes: 2 additions & 2 deletions src/expressions/map/MapExpr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* limitations under the License.
*/

import { TestClause } from "../../utils/TestClause";
import Cypher from "../..";
import { TestClause } from "../../utils/TestClause";

describe("Map Expression", () => {
test("Create from object", () => {
Expand Down Expand Up @@ -83,6 +83,6 @@ describe("Map Expression", () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
myValue: "" as any,
});
}).toThrowError("Missing value on map key myValue");
}).toThrow("Missing value on map key myValue");
});
});
4 changes: 2 additions & 2 deletions src/expressions/map/MapProjection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* limitations under the License.
*/

import { TestClause } from "../../utils/TestClause";
import Cypher from "../..";
import { TestClause } from "../../utils/TestClause";

describe("Map Projection", () => {
test("Project empty map", () => {
Expand Down Expand Up @@ -114,6 +114,6 @@ describe("Map Projection", () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
myValue: "" as any,
});
}).toThrowError("Missing value on map key myValue");
}).toThrow("Missing value on map key myValue");
});
});
2 changes: 1 addition & 1 deletion src/namespaces/db/db.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe("db procedures", () => {
test("db.labels with yield fails if projection is empty", () => {
expect(() => {
Cypher.db.labels().yield();
}).toThrowError("Empty projection in CALL ... YIELD");
}).toThrow("Empty projection in CALL ... YIELD");
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/utils/compile-cypher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("utils.compileCypher", () => {
expect(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Cypher.utils.compileCypher(matchClause, undefined as any);
}).toThrowError("Missing env when compiling Cypher");
}).toThrow("Missing env when compiling Cypher");
});

test("fails if element is not compilable", () => {
Expand All @@ -65,7 +65,7 @@ describe("utils.compileCypher", () => {
});
expect(() => {
raw.build();
}).toThrowError("Invalid element, missing `getCypher` method");
}).toThrow("Invalid element, missing `getCypher` method");
});

test("Return empty string if compiled cypher is empty", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/clause-chaining.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ describe("Clause chaining", () => {
match.return("*");
expect(() => {
match.return("*");
}).toThrowError("Cannot chain 2 top-level clauses to the same clause");
}).toThrow("Cannot chain 2 top-level clauses to the same clause");
});
});
});

0 comments on commit 0d534b5

Please sign in to comment.