Skip to content

Commit

Permalink
fix prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzuo committed Sep 25, 2023
1 parent a098042 commit bc75632
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 24 deletions.
48 changes: 24 additions & 24 deletions internal/integration/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test("queryOne", async () => {
let user = await c.queryUser().create({ name: "test" });
let row = await c.queryOne<{ user_id: number }>(
"select id as user_id from users where id = ?",
user.id
user.id,
);
expect(row.user_id).toEqual(user.id);
});
Expand All @@ -22,7 +22,7 @@ test("query", async () => {
let user2 = await c.queryUser().create({ name: "test2" });
let rows = await c.query<{ user_name: string }>(
"select name as user_name from users where id in (?)",
[user1.id, user2.id]
[user1.id, user2.id],
);
expect(rows).toEqual([{ user_name: "test1" }, { user_name: "test2" }]);
});
Expand All @@ -32,7 +32,7 @@ test("exec", async () => {
let updated = await c.exec(
"update users set name = ? where id = ?",
"test1",
user.id
user.id,
);
expect(updated).toEqual(1);
let deleted = await c.exec("delete from users where id = ?", user.id);
Expand Down Expand Up @@ -122,7 +122,7 @@ test("datetime", async () => {
c.userID
.eq(user.id)
.and(c.userDatetime.gte(s1))
.and(c.userDatetime.lte(s1))
.and(c.userDatetime.lte(s1)),
)
.first();
expect(format(user.datetime!, "yyyy-MM-dd HH:mm:ss")).toEqual(s1);
Expand Down Expand Up @@ -365,35 +365,35 @@ test("transaction", async () => {
});

test("transactionBlock", async () => {
await c.queryTag().deleteAll()
await c.queryTag().deleteAll();

let tag1 = await c.queryTag().create({name: "tag1"});
expect(tag1.name).toEqual("tag1");
let tag1 = await c.queryTag().create({ name: "tag1" });
expect(tag1.name).toEqual("tag1");

let total1 = await c.queryTag().count();
let total1 = await c.queryTag().count();

await c.transaction(async function (tx: Tx) {
tag1 = await tx.queryTag().find(tag1.id);
await tag1.update({name: "tag1-updated"});
await c.transaction(async function (tx: Tx) {
tag1 = await tx.queryTag().find(tag1.id);
await tag1.update({ name: "tag1-updated" });

await tx.queryTag().create({name: "tag2"});
await tx.queryTag().create({name: "tag3"});
await tx.queryTag().create({ name: "tag2" });
await tx.queryTag().create({ name: "tag3" });

let total2 = await c.queryTag().count();
expect(total2).toEqual(total1);
let total2 = await c.queryTag().count();
expect(total2).toEqual(total1);

let total3 = await tx.queryTag().count();
expect(total3).toEqual(total1 + 2);
let total3 = await tx.queryTag().count();
expect(total3).toEqual(total1 + 2);

tag1 = await c.queryTag().find(tag1.id);
expect(tag1.name).toEqual("tag1");
})
tag1 = await c.queryTag().find(tag1.id);
expect(tag1.name).toEqual("tag1");
});

let total4 = await c.queryTag().count();
expect(total4).toEqual(total1 + 2);
let total4 = await c.queryTag().count();
expect(total4).toEqual(total1 + 2);

tag1 = await c.queryTag().find(tag1.id);
expect(tag1.name).toEqual("tag1-updated");
tag1 = await c.queryTag().find(tag1.id);
expect(tag1.name).toEqual("tag1-updated");
});

test("changeJSON", async () => {
Expand Down
3 changes: 3 additions & 0 deletions internal/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
"pg": "^8.11.1",
"typescript": "^5.1.6",
"vitest": "^0.32.2"
},
"devDependencies": {
"prettier": "^3.0.3"
}
}
5 changes: 5 additions & 0 deletions internal/integration/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,11 @@ prebuild-install@^7.1.0:
tar-fs "^2.0.0"
tunnel-agent "^0.6.0"

prettier@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643"
integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==

pretty-format@^27.5.1:
version "27.5.1"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e"
Expand Down

0 comments on commit bc75632

Please sign in to comment.