Skip to content

Commit

Permalink
test: stop dynamic importing of entities using the glob pattern (part…
Browse files Browse the repository at this point in the history
…2) (#75)
  • Loading branch information
uki00a authored Jun 20, 2020
1 parent 9a9de70 commit 27c887b
Show file tree
Hide file tree
Showing 22 changed files with 28 additions and 84 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {join as joinPaths} from "../../../../../vendor/https/deno.land/std/path/mod.ts";
import {expect} from "../../../../deps/chai.ts";
import {runIfMain} from "../../../../deps/mocha.ts";
import {getDirnameOfCurrentModule, closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {Connection} from "../../../../../src/index.ts";
import {Category} from "./entity/Category.ts";
import {Post} from "./entity/Post.ts";
Expand All @@ -10,9 +9,8 @@ import {Image} from "./entity/Image.ts";
describe("query builder > relation-count-decorator-many-to-many > many-to-many", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Image, Post],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {join as joinPaths} from "../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../deps/mocha.ts";
import {expect} from "../../../../deps/chai.ts";
import {getDirnameOfCurrentModule, closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {Connection} from "../../../../../src/connection/Connection.ts";
import {Category} from "./entity/Category.ts";
import {Post} from "./entity/Post.ts";
Expand All @@ -10,9 +9,8 @@ import {Image} from "./entity/Image.ts";
describe("decorators > relation-count-decorator > one-to-many", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Image, Post],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {join as joinPaths} from "../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../deps/mocha.ts";
import {expect} from "../../../../deps/chai.ts";
import {getDirnameOfCurrentModule, closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {Connection} from "../../../../../src/connection/Connection.ts";
import {Post} from "./entity/Post.ts";
import {Category} from "./entity/Category.ts";
Expand All @@ -10,9 +9,8 @@ import {Image} from "./entity/Image.ts";
describe("decorators > relation-id-decorator > many-to-many", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Image, Post],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import {join as joinPaths} from "../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../deps/mocha.ts";
import {expect} from "../../../../deps/chai.ts";
import {getDirnameOfCurrentModule, closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {Connection} from "../../../../../src/connection/Connection.ts";
import {Post} from "./entity/Post.ts";
import {Category} from "./entity/Category.ts";

describe("decorators > relation-id-decorator > many-to-one", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Post],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import {join as joinPaths} from "../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../deps/mocha.ts";
import {expect} from "../../../../deps/chai.ts";
import {getDirnameOfCurrentModule, closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {Connection} from "../../../../../src/connection/Connection.ts";
import {Category} from "./entity/Category.ts";
import {Post} from "./entity/Post.ts";

describe("decorators > relation-id > one-to-many", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Post],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import {join as joinPaths} from "../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../deps/mocha.ts";
import {expect} from "../../../../deps/chai.ts";
import {getDirnameOfCurrentModule, closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../../utils/test-utils.ts";
import {Connection} from "../../../../../src/connection/Connection.ts";
import {Category} from "./entity/Category.ts";
import {Post} from "./entity/Post.ts";

describe("decorators > relation-id > one-to-one", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Post],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {join as joinPaths} from "../../../../vendor/https/deno.land/std/path/mod.ts";
import {getDirnameOfCurrentModule, closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils.ts";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils.ts";
import {Connection} from "../../../../src/connection/Connection.ts";
import {Post} from "./entity/Post.ts";
import {Category} from "./entity/Category.ts";
Expand All @@ -9,7 +8,6 @@ import "../../../deps/chai.ts";
describe("persistence > cascade operations with custom name", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [Category, Post],
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -16,9 +14,8 @@ import {PostCategory} from "./entity/PostCategory.ts";
describe("query builder > relation-id > many-to-one > basic-functionality", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Image, Post, PostCategory],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -17,9 +15,8 @@ import {Subcounters} from "./entity/Subcounters.ts";
describe("query builder > relation-id > many-to-one > embedded-with-multiple-pk", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Counters, Post, Subcounters, User],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -17,9 +15,8 @@ import {Subcounters} from "./entity/Subcounters.ts";
describe("query builder > relation-id > many-to-one > embedded", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Counters, Post, Subcounters, User],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -15,9 +13,8 @@ import {Image} from "./entity/Image.ts";
describe("query builder > relation-id > many-to-one > multiple-pk", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Image, Post],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -15,9 +13,8 @@ import {Image} from "./entity/Image.ts";
describe("query builder > relation-id > one-to-many > basic-functionality", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Image, Post],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -17,9 +15,8 @@ import {Subcounters} from "./entity/Subcounters.ts";
describe("query builder > relation-id > one-to-many > embedded-with-multiple-pk", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Counters, Post, Subcounters, User],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -17,9 +15,8 @@ import {Subcounters} from "./entity/Subcounters.ts";
describe("query builder > relation-id > one-to-many > embedded", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Counters, Post, Subcounters, User],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -15,9 +13,8 @@ import {Image} from "./entity/Image.ts";
describe("query builder > relation-id > one-to-many > multiple-pk", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Image, Post]
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -14,9 +12,8 @@ import {Post} from "./entity/Post.ts";
describe("query builder > relation-id > one-to-one > basic-functionality", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Post],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -17,9 +15,8 @@ import {Subcounters} from "./entity/Subcounters.ts";
describe("query builder > relation-id > one-to-one > embedded-with-multiple-pk", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Counters, Post, Subcounters, User],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -17,9 +15,8 @@ import {Subcounters} from "./entity/Subcounters.ts";
describe("query builder > relation-id > one-to-one > embedded", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Counters, Post, Subcounters, User],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {join as joinPaths} from "../../../../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../../../../deps/mocha.ts";
import {expect} from "../../../../../deps/chai.ts";
import {
getDirnameOfCurrentModule,
closeTestingConnections,
createTestingConnections,
reloadTestingDatabases
Expand All @@ -15,9 +13,8 @@ import {Image} from "./entity/Image.ts";
describe("query builder > relation-id > one-to-one > multiple-pk", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [joinPaths(__dirname, "/entity/*.ts")],
entities: [Category, Image, Post],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down
4 changes: 1 addition & 3 deletions test/github-issues/3551/issue-3551.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import {join as joinPaths} from "../../../vendor/https/deno.land/std/path/mod.ts";
import {runIfMain} from "../../deps/mocha.ts";
import "../../deps/chai.ts";
import {Connection} from "../../../src/connection/Connection.ts";
import {getDirnameOfCurrentModule, closeTestingConnections, createTestingConnections} from "../../utils/test-utils.ts";
import {closeTestingConnections, createTestingConnections} from "../../utils/test-utils.ts";
import {PromiseUtils} from "../../../src/index.ts";
import { Book, Chapter, Page } from "./entity/Book.ts";

describe("github issues > #3551 array of embedded documents through multiple levels are not handled", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => {
connections = await createTestingConnections({
entities: [Book, Chapter, Page],
Expand Down
Loading

0 comments on commit 27c887b

Please sign in to comment.