From efe2cf9b4b3f0eae107447aa32a30eebd73447c8 Mon Sep 17 00:00:00 2001 From: JimmyDaddy Date: Thu, 1 Feb 2024 19:07:01 +0800 Subject: [PATCH] fix: fix unittest --- test/types/spell.test.ts | 2 +- test/unit/spell.test.js | 4 ++-- tsconfig.json | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/types/spell.test.ts b/test/types/spell.test.ts index 2c405df8..7da65e36 100644 --- a/test/types/spell.test.ts +++ b/test/types/spell.test.ts @@ -291,7 +291,7 @@ describe('=> Spell (TypeScript)', function() { it('arbitrary join', function() { assert.equal( Post.join(Comment, 'comments.articleId = posts.id').toString(), - 'SELECT `posts`.*, `comments`.* FROM `articles` AS `posts` LEFT JOIN `comments` AS `comments` ON `comments`.`article_id` = `posts`.`id` WHERE `posts`.`gmt_deleted` IS NULL' + 'SELECT `posts`.*, `comments`.* FROM `articles` AS `posts` LEFT JOIN `comments` AS `comments` ON `posts`.`id` = `comments`.`article_id` WHERE `posts`.`gmt_deleted` IS NULL' ); }); }); diff --git a/test/unit/spell.test.js b/test/unit/spell.test.js index 060be49d..1d1ab159 100644 --- a/test/unit/spell.test.js +++ b/test/unit/spell.test.js @@ -587,7 +587,7 @@ describe('=> Spell', function() { it('arbitrary join', function() { assert.equal( Post.join(Comment, 'comments.articleId = posts.id').toString(), - 'SELECT `posts`.*, `comments`.* FROM `articles` AS `posts` LEFT JOIN `comments` AS `comments` ON `comments`.`article_id` = `posts`.`id` WHERE `posts`.`gmt_deleted` IS NULL' + 'SELECT `posts`.*, `comments`.* FROM `articles` AS `posts` LEFT JOIN `comments` AS `comments` ON `posts`.`id` = `comments`.`article_id` AND `comments`.`gmt_deleted` IS NULL WHERE `posts`.`gmt_deleted` IS NULL' ); assert.equal(Post.include('comments').limit(1).toSqlString(), heresql(function () { @@ -615,7 +615,7 @@ describe('=> Spell', function() { assert.equal( Post.join(Comment, 'comments.articleId = posts.id').limit(1).toString(), - 'SELECT `posts`.*, `comments`.* FROM `articles` AS `posts` LEFT JOIN `comments` AS `comments` ON `comments`.`article_id` = `posts`.`id` WHERE `posts`.`gmt_deleted` IS NULL LIMIT 1' + 'SELECT `posts`.*, `comments`.* FROM `articles` AS `posts` LEFT JOIN `comments` AS `comments` ON `posts`.`id` = `comments`.`article_id` AND `comments`.`gmt_deleted` IS NULL WHERE `posts`.`gmt_deleted` IS NULL LIMIT 1' ); }); diff --git a/tsconfig.json b/tsconfig.json index 1b3ae529..a051bab9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,8 @@ "target": "ES2020", }, "include": [ - "src/**/*" + "src/**/*", + "test/**/*.ts" ], "exclude": [ "dist",