Skip to content

Commit

Permalink
working "github issues > #813 order by must support functions"
Browse files Browse the repository at this point in the history
  • Loading branch information
bbakhrom committed Mar 19, 2019
1 parent bd35004 commit 22d5a72
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Entity, PrimaryGeneratedColumn} from "../../../../src/index";
import {Entity, PrimaryGeneratedColumn} from "../../../../src";

@Entity()
export class Category {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import "reflect-metadata";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../utils/test-utils";
import {Connection} from "../../../src/connection/Connection";
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../../test/utils/test-utils";
import {Connection} from "../../../src";
import {Post} from "./entity/Post";
import {MysqlDriver} from "../../../src/driver/mysql/MysqlDriver";
import {Category} from "./entity/Category";

describe("github issues > #813 order by must support functions", () => {

let connections: Connection[];
before(async () => connections = await createTestingConnections({
beforeAll(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"],
}));
beforeEach(() => reloadTestingDatabases(connections));
after(() => closeTestingConnections(connections));
afterAll(() => closeTestingConnections(connections));

it("should work perfectly", () => Promise.all(connections.map(async connection => {
test("should work perfectly", () => Promise.all(connections.map(async connection => {
if (!(connection.driver instanceof MysqlDriver))
return;

Expand All @@ -31,11 +31,11 @@ describe("github issues > #813 order by must support functions", () => {
.orderBy("RAND()")
.getMany();

posts[0].id.should.be.equal(1);
posts[0].title.should.be.equal("About order by");
expect(posts[0].id).toEqual(1);
expect(posts[0].title).toEqual("About order by");
})));

it("should work perfectly with pagination as well", () => Promise.all(connections.map(async connection => {
test("should work perfectly with pagination as well", () => Promise.all(connections.map(async connection => {
if (!(connection.driver instanceof MysqlDriver))
return;

Expand All @@ -55,8 +55,8 @@ describe("github issues > #813 order by must support functions", () => {
.getMany();


posts[0].id.should.be.equal(1);
posts[0].title.should.be.equal("About order by");
expect(posts[0].id).toEqual(1);
expect(posts[0].title).toEqual("About order by");
})));

});

0 comments on commit 22d5a72

Please sign in to comment.