Skip to content
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

fix: make functional tests pass with deno #7

Merged
merged 170 commits into from
Feb 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
9326f4e
fix: test/functional/cascades
uki00a Feb 3, 2020
544c174
fix
uki00a Feb 5, 2020
cbe7531
fix: /test/functional/columns/embedded-columns/columns-embedded-colum…
uki00a Feb 5, 2020
3e6cda2
fix: test/functional/columns/getters-setters
uki00a Feb 8, 2020
099afc8
fix: test/functional/columns/no-select
uki00a Feb 8, 2020
465095f
fix: test/functional/columns/readonly
uki00a Feb 8, 2020
7562ab8
fix: test/functional/columns/update-insert
uki00a Feb 8, 2020
6f4045e
fix:: test/functional/columns/value-transformer
uki00a Feb 8, 2020
6ea09fe
fix: test/functional/connection
uki00a Feb 8, 2020
d3de822
fix: disable loggng on CI
uki00a Feb 8, 2020
9db6926
fix: test/functional/connection-manager
uki00a Feb 8, 2020
72638fb
fix: test/functional/connection-options-reader
uki00a Feb 8, 2020
0afd522
fix(ci): add ---allow-env
uki00a Feb 8, 2020
957cc95
fix: exit code
uki00a Feb 8, 2020
eac176c
fix: timeout
uki00a Feb 8, 2020
78ecf24
fix: test/functional/cube
uki00a Feb 8, 2020
a8f2779
fix: test/functional/database-schema/column-collation
uki00a Feb 8, 2020
8c772bf
fix: test/functional/database-schema/column-length
uki00a Feb 8, 2020
361233f
fix: test/functional/database-schema/column-types
uki00a Feb 8, 2020
608182a
fix: test/functional/database/schema/column-width
uki00a Feb 9, 2020
1011928
fix: test/functional/database-schema/enums
uki00a Feb 9, 2020
2347fff
fix: test/functional/database-schema/enums-array/enums-array.ts
uki00a Feb 9, 2020
3979dcc
fix: test/functional/database-schema/indices
uki00a Feb 9, 2020
f9a1dde
fix: test/functional/database-schema/mssql-parameters
uki00a Feb 9, 2020
aefbda2
fix: test/functional/database-schema/rowid-column
uki00a Feb 9, 2020
630f0fe
fix: test/functional/database-schema/sequence
uki00a Feb 9, 2020
e6d6382
fix: test/functional/database-schema/simple-enums
uki00a Feb 9, 2020
437342d
fix: test/functional/database-schema/simple-enums-array
uki00a Feb 9, 2020
095b901
fix: test/functional/decorators/embedded
uki00a Feb 9, 2020
91ff187
fix: test/functional/decorators/relation-count
uki00a Feb 9, 2020
0d20db0
fix: test/functional/decorators/relation-id/relation-id-many-to-many
uki00a Feb 9, 2020
2ca62b4
fix: test/functional/decorators/relation-id/relation-id-many-to-one
uki00a Feb 9, 2020
779d3ef
fix: test/functional/decorators/relation-id/relation-id-one-to-many
uki00a Feb 9, 2020
5c351f6
fix: test/functional/decorators/relation-id/relation-id-one-to-one
uki00a Feb 9, 2020
1c727c8
fix: test/functional/deferrable
uki00a Feb 9, 2020
fe5d4a6
fix: test/functional/embedded/basic-functionality
uki00a Feb 9, 2020
7349fe1
fix: test/functional/embedded/embedded-listeners
uki00a Feb 9, 2020
f16fd55
fix: test/functional/embedded/embedded/many-to-many-case1
uki00a Feb 9, 2020
8af325d
fix: test/functional/embedded/embedded-many-to-many-case2
uki00a Feb 9, 2020
8004154
fix: test/functional/embedded/embedded-many-to-many-case3
uki00a Feb 9, 2020
076f408
fix: test/functional/embedded/embedded-many-to-many-case4
uki00a Feb 9, 2020
785d918
fix: test/functional/embedded/embedded-many-to-many-case5
uki00a Feb 9, 2020
924f879
fix: test/functional/embedded/embedded-many-to-one-case1
uki00a Feb 9, 2020
0ec4477
fix: test/functional/embedded/embedded-many-to-many-case2
uki00a Feb 9, 2020
f057bb5
fix: test/functional/embedded/embedded-many-to-one-case3
uki00a Feb 9, 2020
44762c0
fix: test/functional/embedded/embedded-many-to-one-case4
uki00a Feb 9, 2020
56924b1
fix: test/functional/embedded/embedded-many-to-one-case5
uki00a Feb 9, 2020
2db23b0
fix: test/functional/embedded/embedded-one-to-one
uki00a Feb 9, 2020
0d38190
fix: test/functional/embedded/embedded-with-special-columns
uki00a Feb 9, 2020
587c076
fix: test/functional/embedded/multiple-primary-columns
uki00a Feb 11, 2020
9cf135d
fix: test/functional/embedded/multiple-primary-columns-with-nested-embed
uki00a Feb 11, 2020
cf39c06
fix: test/functional/embedded/optional-embedded-listeners
uki00a Feb 11, 2020
034dece
fix: test/functional/embedded/outer-primary-column
uki00a Feb 11, 2020
fbe84d5
fix: test/functional/embedded/prefix
uki00a Feb 11, 2020
d64322e
fix: test/functional/entity-listeners
uki00a Feb 11, 2020
1000106
fix: test/functional/entity-metadata
uki00a Feb 11, 2020
6c4f63c
fix: test/functional/entity-metadata-validator/basic
uki00a Feb 11, 2020
2ab54d0
fix: test/functional/entity-metadata-validator/initialized-relations
uki00a Feb 11, 2020
01ba114
fix: test/functional/entity-model
uki00a Feb 11, 2020
bab0f35
fix: test/functional/entity-schema/basic
uki00a Feb 11, 2020
f5d611d
fix: test/functional/entity-schema/checks
uki00a Feb 11, 2020
9ef42c3
fix: test/functional/entity-schema/columns
uki00a Feb 11, 2020
27c99ba
fix: test/functional/entity-schema/exclusions
uki00a Feb 11, 2020
0adfe9f
fix: test/functional/entity-schema/indices/basic
uki00a Feb 11, 2020
d1ba5df
fix: test/functional/entity-schema/indices/mysql
uki00a Feb 11, 2020
295dae8
fix: test/functional/entity-schema/target
uki00a Feb 11, 2020
863c1d8
fix: test/functional/entity-schema/uniques
uki00a Feb 11, 2020
1bf58db
fix: test/functional/indices/basic-unique-index-test
uki00a Feb 11, 2020
ddd1c6b
fix: test/functional/indices/conditional-index
uki00a Feb 11, 2020
ac78c3b
fix: test/functional/indices/embeddes-index-test
uki00a Feb 11, 2020
ff11e1c
fix: test/functional/json
uki00a Feb 11, 2020
6085448
fix: test/functional/metadata-builder/column-metadata
uki00a Feb 11, 2020
e823321
fix: test/functional/metadata-builder/metadata-args-storage
uki00a Feb 11, 2020
db6138d
fix: test/functional/migrations/show-command
uki00a Feb 11, 2020
2382041
fix: test/functional/mongodb/basic/array-columns
uki00a Feb 11, 2020
66ef3e2
fix: test/functional/mongodb/basic/embedded-columns
uki00a Feb 11, 2020
9406293
fix: test/functional/mongodb/basic/embedded-columns-listeners
uki00a Feb 11, 2020
00fec90
fix: test/functional/mongodb/basic/mongodb-embeddes-index
uki00a Feb 11, 2020
83498a8
fix: test/functional/mongodb/basic/mongo-index
uki00a Feb 11, 2020
84a47ed
fix: test/functional/mongodb/basic/mongo-repository
uki00a Feb 11, 2020
27af820
fix: test/functional/mongodb/basic/object-id
uki00a Feb 11, 2020
56c9610
fix: test/functional/mongodb/basic/repository-actions
uki00a Feb 11, 2020
a71b64d
fix: test/functional/mongodb/basic/timestampable-columns
uki00a Feb 11, 2020
d54b531
fix: test/functional/multi-schema-and-database/custom-junction-database
uki00a Feb 11, 2020
8ad1fe7
fix: test/functional/multi-schema-and-database/custom-junction-schema
uki00a Feb 11, 2020
41ad32d
fix: test/functional/multi-schema-and-database/multi-schema-and-datab…
uki00a Feb 11, 2020
4156fe2
fix: test/functional/persistence/basic-functionality
uki00a Feb 11, 2020
6071707
fix
uki00a Feb 11, 2020
6d76f33
fix: test/functional/persistence/bulk-insert-remove-optimization
uki00a Feb 11, 2020
25eb986
fix: test/functional/persistence/cascades/cascades-example1
uki00a Feb 11, 2020
900c080
fix: test/functional/persistence/cascades/cascades-example2
uki00a Feb 11, 2020
f5194fc
fix: test/functional/persistence/cascades/cascades-remove
uki00a Feb 11, 2020
d10b488
fix: test/functional/persistence/custom-column-name-pk
uki00a Feb 11, 2020
8f21eb4
fix: test/functional/persistence/custom-column-names
uki00a Feb 11, 2020
38c373c
fix: test/functional/persistence/entity-updation
uki00a Feb 11, 2020
7b4ed20
fix: test/functional/persistence/insert
uki00a Feb 11, 2020
1fd4861
fix: test/functional/persistence/many-to-many
uki00a Feb 11, 2020
3059c4c
fix: test/functional/persistence/many-to-one-bi-directional
uki00a Feb 11, 2020
0716ea0
fix: test/functional/persistence/many-to-one-uni-directional
uki00a Feb 11, 2020
beba7c0
fix: test/functional/persistence/multi-primary-keys
uki00a Feb 11, 2020
28ff48d
fix: test/functional/persistence/multi-primary-key-on-both-sides
uki00a Feb 11, 2020
3e7a1fa
fix: test/functional/persistence/null-and-default-behaviour
uki00a Feb 11, 2020
15f7500
fix: test/functional/persistence/one-to-many
uki00a Feb 11, 2020
3a833ee
fix: test/functional/persistence/one-to-one
uki00a Feb 11, 2020
8626534
fix: test/functional/persistence/partial-persist
uki00a Feb 11, 2020
d564bd6
fix: test/functional/persistence/persistence-options/chunks
uki00a Feb 11, 2020
8f5cd03
fix: test/functional/persistence/persist-options/listeners
uki00a Feb 11, 2020
cbf1e8f
fix: test/functional/persistence/persistence-options/transaction
uki00a Feb 11, 2020
41ede58
fix: test/functional/persistence/persistence-order
uki00a Feb 11, 2020
cceedd9
fix: test/functional/persistence/remove-topolotical-order
uki00a Feb 11, 2020
40dd173
fix: test/functional/query-builder/brackets
uki00a Feb 12, 2020
6179992
fix: test/functional/query-builder/cache
uki00a Feb 12, 2020
6cc8ba0
fix: test/functional/query-builder/delete
uki00a Feb 12, 2020
25e6d95
fix: test/functional/query-builder/distinct-on
uki00a Feb 12, 2020
f7d9ec0
fix: test/functional/query-builder/enabling-transaction
uki00a Feb 12, 2020
d95a689
fix: test/functional/query-builder/entity-updation
uki00a Feb 12, 2020
38b0616
fix: test/functional/query-builder/insert
uki00a Feb 12, 2020
3e3292e
fix: test/functional/query-builder/insert-on-conflict
uki00a Feb 12, 2020
86552aa
fix: test/functional/query-builder/join
uki00a Feb 12, 2020
0840c3c
fix: test/functional/query-builder/locking
uki00a Feb 13, 2020
22e7209
fix: test/functional/query-builder/order-by
uki00a Feb 13, 2020
2d31c17
fix: test/functional/query-builder/relation-count/relation-count-many…
uki00a Feb 13, 2020
ff9fd62
fix: test/functional/query-builder/relation-count/relation-count-one-…
uki00a Feb 13, 2020
83c0f7e
fix: test/functional/query-builder/relation-id/many-to-many/basic-fun…
uki00a Feb 13, 2020
aca1da7
fix: test/functional/query-builder/relation-id/embedded
uki00a Feb 13, 2020
752de80
fix: test/functional/query-builder/relation-id/many-to-many/embedded-…
uki00a Feb 13, 2020
3562a41
fix: test/functional/query-builder/relation-id/many-to-many/multiple-pk
uki00a Feb 13, 2020
79e97eb
fix: test/functional/query-builder/relation-id/many-to-one/basic-func…
uki00a Feb 13, 2020
731efae
fix: test/functional/query-builder/relation-id/many-to-one/embedded
uki00a Feb 13, 2020
94bd373
fix: test/functional/query-builder/relation-id/many-to-one/embedded-w…
uki00a Feb 13, 2020
8e97588
fix: test/functional/query-builder/relation-id/many-to-one/multiple-pk
uki00a Feb 13, 2020
c762530
fix: test/functional/query-builder/relation-id/one-to-many
uki00a Feb 13, 2020
3af0a7e
fix: test/functional/query-builder/relation-id/one-to-many/embedded
uki00a Feb 13, 2020
f26e3d4
fix: test/functional/query-builder/relation-id/one-to-many/embedded-w…
uki00a Feb 13, 2020
3a19f6a
fix: test/functional/query-builder/relation-id/one-to-many/multiple-pk
uki00a Feb 13, 2020
3bc552d
fix: test/functional/query-builder/relation-id/one-to-one/basic-funct…
uki00a Feb 13, 2020
160830b
fix: test/functional/query-builder/relation-id/one-to-one/embedded
uki00a Feb 13, 2020
8f81fa7
fix: test/functional/query-builder/relation-id/one-to-one/embedded-wi…
uki00a Feb 13, 2020
a599716
fix: test/functional/query-builder/entity-id/one-to-one/multiple-pk
uki00a Feb 13, 2020
d8c89f4
fix
uki00a Feb 13, 2020
7994ec6
fix
uki00a Feb 13, 2020
a1abdb9
fix
uki00a Feb 14, 2020
e574fd2
temporary fix
uki00a Feb 14, 2020
0d7319a
temporary fix
uki00a Feb 14, 2020
9ccecaa
temporary fix
uki00a Feb 14, 2020
f24333d
fix
uki00a Feb 14, 2020
e5435b8
fix
uki00a Feb 14, 2020
559b811
temporary fix
uki00a Feb 14, 2020
8428a30
temporary fix
uki00a Feb 14, 2020
4e39cca
fix
uki00a Feb 14, 2020
f475883
fix
uki00a Feb 15, 2020
27e69b7
fix: test/functional/query-builder/relational/with-many
uki00a Feb 15, 2020
b2b2c7f
fix: test/functional/query-builder/relational/with-one
uki00a Feb 15, 2020
ad30673
fix: test/functional/query-builder/select
uki00a Feb 15, 2020
d361595
fix: test/functional/query-builder/sub-query
uki00a Feb 15, 2020
c9471b5
fix: test/functional/query-builder/update
uki00a Feb 15, 2020
c0c6566
fix: test/functional/query-runner
uki00a Feb 16, 2020
e50f7a5
fix: disable logging on ci
uki00a Feb 16, 2020
1d308a5
fix: test/functional/relations
uki00a Feb 16, 2020
2b38602
fix(mocha): set global timeout
uki00a Feb 16, 2020
75d85dc
fix: test/functional/repository
uki00a Feb 16, 2020
e587f52
fix: test/functional/schema-builder
uki00a Feb 16, 2020
a22daf1
fix: test/functional/spatial
uki00a Feb 16, 2020
873dd9f
fix: timeout
uki00a Feb 16, 2020
d2c1e20
fix: test/functional/sqljs
uki00a Feb 16, 2020
740f172
fix: test/functional/table-inheritance
uki00a Feb 16, 2020
c836e73
fix: test/functional/transaction
uki00a Feb 16, 2020
2bb2926
fix: test/functional/tree-table
uki00a Feb 16, 2020
7299fa2
fix: test/functional/uuid
uki00a Feb 16, 2020
69da42d
fix: test/functional/view-entity
uki00a Feb 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
- name: Run tests
run: |
cp ./ormconfig.gh-actions.json ./ormconfig.json
deno run --allow-read --allow-write --config ./tsconfig.json ./test.ts
deno run --allow-read --allow-write --allow-env --config ./tsconfig.json ./test.ts
4 changes: 2 additions & 2 deletions ormconfig.gh-actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"skip": false,
"name": "sqlite",
"type": "sqlite",
"database": "temp/sqlitedb.db",
"logging": true
"database": ":memory:",
"logging": false
}
]
16 changes: 10 additions & 6 deletions src/connection/ConnectionOptionsReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ export class ConnectionOptionsReader {
connectionOptions = new ConnectionOptionsEnvReader().read();

} else if (foundFileFormat === "js") {
connectionOptions = await PlatformTools.load(configFile);
const mod = await import(configFile);
connectionOptions = await mod.default;

} else if (foundFileFormat === "ts") {
connectionOptions = await PlatformTools.load(configFile);
const mod = await import(configFile);
connectionOptions = await mod.default;

} else if (foundFileFormat === "json") {
connectionOptions = PlatformTools.load(configFile);
Expand Down Expand Up @@ -197,10 +199,12 @@ export class ConnectionOptionsReader {
* Gets directory where configuration file should be located.
*/
protected get baseDirectory(): string {
if (this.options && this.options.root)
return this.options.root;

return PlatformTools.load("app-root-path").path;
const baseDirectory = this.options && this.options.root
? this.options.root
: PlatformTools.load("app-root-path").path;
return baseDirectory.endsWith('/')
? baseDirectory.slice(0, -1)
: baseDirectory;
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/driver/sqlite/SqliteQueryRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export class SqliteQueryRunner extends AbstractSqliteQueryRunner {
await this.saveDatabaseToFileIfNeeded(databaseConnection, query);
return result;
} catch (err) {
console.error(err)
connection.logger.logQueryError(err, query, parameters, this);
throw new QueryFailedError(query, parameters, err);
}
Expand Down
3 changes: 2 additions & 1 deletion src/driver/types/ColumnTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,5 @@ export type ColumnType = WithPrecisionColumnType
|BooleanConstructor
|DateConstructor
|NumberConstructor
|StringConstructor;
|StringConstructor
|Uint8ArrayConstructor; // TODO(uki001) This type is not fully tested yet.
8 changes: 8 additions & 0 deletions src/platform/PlatformTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ export class PlatformTools {
return Deno.env()[name];
}

static encodeToBase64(string: string): string {
return window.btoa(string);
}

static decodeFromBase64(base64: string): string {
return window.atob(base64);
}

// TODO(uki00a) implement this method.
/**
* Highlights sql string to be print in the console.
Expand Down
252 changes: 252 additions & 0 deletions test.ts

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions test/deps/mocha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ import "https://unpkg.com/[email protected]/mocha.js";
mocha.setup({ ui: 'bdd', reporter: 'spec' });

export function runTests(): void {
mocha.run();
mocha.run(onCompleted);
}

export function runIfMain(meta: ImportMeta): void {
if (meta.main) {
mocha.run();
mocha.run(onCompleted);
}
}

mocha.timeout(60000);

function onCompleted(failures: number): void {
if (failures > 0) {
Deno.exit(1);
} else {
Deno.exit(0);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import "reflect-metadata";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils";
import {Connection} from "../../../../src/connection/Connection";
import {Post} from "./entity/Post";
import {PostDetails} from "./entity/PostDetails";
import {runIfMain} from "../../../deps/mocha.ts";
import {expect} from "../../../deps/chai.ts";
import {getDirnameOfCurrentModule, closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils.ts";
import {Connection} from "../../../../src/connection/Connection.ts";
import {Post} from "./entity/Post.ts";
import {PostDetails} from "./entity/PostDetails.ts";
import {join} from "../../../../vendor/https/deno.land/std/path/mod.ts"

describe("cascades > should insert by cascades from both sides (#57)", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
entities: [join(__dirname, "/entity/*.ts")]
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand All @@ -35,7 +38,7 @@ describe("cascades > should insert by cascades from both sides (#57)", () => {
}
});

posts.should.be.eql([{
expect(posts).to.eql([{
key: post1.key,
title: post1.title,
details: {
Expand All @@ -46,3 +49,5 @@ describe("cascades > should insert by cascades from both sides (#57)", () => {
})));

});

runIfMain(import.meta);
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Entity} from "../../../../../src/decorator/entity/Entity";
import {Column} from "../../../../../src/decorator/columns/Column";
import {PrimaryGeneratedColumn} from "../../../../../src/decorator/columns/PrimaryGeneratedColumn";
import {PostDetails} from "./PostDetails";
import {OneToOne} from "../../../../../src/decorator/relations/OneToOne";
import {JoinColumn} from "../../../../../src/decorator/relations/JoinColumn";
import {Entity} from "../../../../../src/decorator/entity/Entity.ts";
import {Column} from "../../../../../src/decorator/columns/Column.ts";
import {PrimaryGeneratedColumn} from "../../../../../src/decorator/columns/PrimaryGeneratedColumn.ts";
import {PostDetails} from "./PostDetails.ts";
import {OneToOne} from "../../../../../src/decorator/relations/OneToOne.ts";
import {JoinColumn} from "../../../../../src/decorator/relations/JoinColumn.ts";

@Entity()
export class Post {
Expand All @@ -17,7 +17,7 @@ export class Post {
@JoinColumn()
details: PostDetails;

@Column()
@Column({ type: String })
title: string;

}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {Entity} from "../../../../../src/decorator/entity/Entity";
import {PrimaryColumn} from "../../../../../src/decorator/columns/PrimaryColumn";
import {Post} from "./Post";
import {OneToOne} from "../../../../../src/decorator/relations/OneToOne";
import {Entity} from "../../../../../src/decorator/entity/Entity.ts";
import {PrimaryColumn} from "../../../../../src/decorator/columns/PrimaryColumn.ts";
import {Post} from "./Post.ts";
import {OneToOne} from "../../../../../src/decorator/relations/OneToOne.ts";

@Entity()
export class PostDetails {

@PrimaryColumn()
@PrimaryColumn({ type: String })
keyword: string;

@OneToOne(type => Post, post => post.details, {
cascade: ["insert"]
})
post: Post;

}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import "reflect-metadata";
import {expect} from "chai";
import {Connection} from "../../../../src/connection/Connection";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils";
import {SimplePost} from "./entity/SimplePost";
import {SimpleCounters} from "./entity/SimpleCounters";
import {Information} from "./entity/Information";
import {Post} from "./entity/Post";
import {expect} from "../../../deps/chai.ts";
import {runIfMain} from "../../../deps/mocha.ts";
import {Connection} from "../../../../src/connection/Connection.ts";
import {getDirnameOfCurrentModule, closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils.ts";
import {join as joinPaths} from "../../../../vendor/https/deno.land/std/path/mod.ts";
import {SimplePost} from "./entity/SimplePost.ts";
import {SimpleCounters} from "./entity/SimpleCounters.ts";
import {Information} from "./entity/Information.ts";
import {Post} from "./entity/Post.ts";

describe("columns > embedded columns", () => {

let connections: Connection[];
const __dirname = getDirnameOfCurrentModule(import.meta);
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
entities: [joinPaths(__dirname, "/entity/*.ts")],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
Expand Down Expand Up @@ -132,3 +134,5 @@ describe("columns > embedded columns", () => {
]);
})));
});

runIfMain(import.meta);
10 changes: 5 additions & 5 deletions test/functional/columns/embedded-columns/entity/Counters.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Column } from "../../../../../src/decorator/columns/Column";
import { Information } from "./Information";
import { Column } from "../../../../../src/decorator/columns/Column.ts";
import { Information } from "./Information.ts";

export class Counters {
@Column()
@Column({ type: Number })
likes: number;

@Column()
@Column({ type: Number })
comments: number;

@Column()
@Column({ type: Number })
favorites: number;

@Column(type => Information, { prefix: "info" })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Column } from "../../../../../src/decorator/columns/Column";
import { Column } from "../../../../../src/decorator/columns/Column.ts";

export class Information {

@Column({ name: "descr" })
@Column({ name: "descr", type: String })
description: string;
}
12 changes: 6 additions & 6 deletions test/functional/columns/embedded-columns/entity/Post.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Entity } from "../../../../../src/decorator/entity/Entity";
import { Column } from "../../../../../src/decorator/columns/Column";
import { PrimaryGeneratedColumn } from "../../../../../src/decorator/columns/PrimaryGeneratedColumn";
import { Counters } from "./Counters";
import { Entity } from "../../../../../src/decorator/entity/Entity.ts";
import { Column } from "../../../../../src/decorator/columns/Column.ts";
import { PrimaryGeneratedColumn } from "../../../../../src/decorator/columns/PrimaryGeneratedColumn.ts";
import { Counters } from "./Counters.ts";

@Entity()
export class Post {

@PrimaryGeneratedColumn()
id: number;

@Column()
@Column({ type: String })
title: string;

@Column()
@Column({ type: String })
text: string;

@Column(type => Counters)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Column } from "../../../../../src/decorator/columns/Column";
import { Information } from "./Information";
import { Column } from "../../../../../src/decorator/columns/Column.ts";
import { Information } from "./Information.ts";

export class SimpleCounters {

@Column()
@Column({ type: Number })
likes: number;

@Column()
@Column({ type: Number })
comments: number;

@Column()
@Column({ type: Number })
favorites: number;

@Column(type => Information, { prefix: "info" })
Expand Down
12 changes: 6 additions & 6 deletions test/functional/columns/embedded-columns/entity/SimplePost.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Entity } from "../../../../../src/decorator/entity/Entity";
import { Column } from "../../../../../src/decorator/columns/Column";
import { PrimaryGeneratedColumn } from "../../../../../src/decorator/columns/PrimaryGeneratedColumn";
import { SimpleCounters } from "./SimpleCounters";
import { Entity } from "../../../../../src/decorator/entity/Entity.ts";
import { Column } from "../../../../../src/decorator/columns/Column.ts";
import { PrimaryGeneratedColumn } from "../../../../../src/decorator/columns/PrimaryGeneratedColumn.ts";
import { SimpleCounters } from "./SimpleCounters.ts";

@Entity()
export class SimplePost {

@PrimaryGeneratedColumn()
id: number;

@Column()
@Column({ type: String })
title: string;

@Column()
@Column({ type: String })
text: string;

@Column(type => SimpleCounters)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "reflect-metadata";
import {expect} from "chai";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils";
import {Connection} from "../../../../src/connection/Connection";
import {Post} from "./entity/Post";
import {runIfMain} from "../../../deps/mocha.ts";
import {expect} from "../../../deps/chai.ts";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils.ts";
import {Connection} from "../../../../src/connection/Connection.ts";
import {Post} from "./entity/Post.ts";

describe("columns > getters and setters", () => {

Expand Down Expand Up @@ -34,3 +34,5 @@ describe("columns > getters and setters", () => {


});

runIfMain(import.meta);
10 changes: 5 additions & 5 deletions test/functional/columns/getters-setters/entity/Post.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Entity} from "../../../../../src/decorator/entity/Entity";
import {Column} from "../../../../../src/decorator/columns/Column";
import {PrimaryGeneratedColumn} from "../../../../../src/decorator/columns/PrimaryGeneratedColumn";
import {Entity} from "../../../../../src/decorator/entity/Entity.ts";
import {Column} from "../../../../../src/decorator/columns/Column.ts";
import {PrimaryGeneratedColumn} from "../../../../../src/decorator/columns/PrimaryGeneratedColumn.ts";

@Entity()
export class Post {
Expand All @@ -19,9 +19,9 @@ export class Post {
}
}

@Column()
@Column({ type: String })
get title(): string {
return this._title;
}

}
}
12 changes: 7 additions & 5 deletions test/functional/columns/no-select/columns-no-select.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "reflect-metadata";
import {expect} from "chai";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils";
import {Connection} from "../../../../src/connection/Connection";
import {Post} from "./entity/Post";
import {runIfMain} from "../../../deps/mocha.ts";
import {expect} from "../../../deps/chai.ts";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../utils/test-utils.ts";
import {Connection} from "../../../../src/connection/Connection.ts";
import {Post} from "./entity/Post.ts";

describe("columns > no-selection functionality", () => {

Expand Down Expand Up @@ -72,3 +72,5 @@ describe("columns > no-selection functionality", () => {
})));

});

runIfMain(import.meta);
Loading