From 4977042608ce03ec10a482c4f8cf7f96546754de Mon Sep 17 00:00:00 2001 From: Misha Kaletsky Date: Tue, 10 Aug 2021 18:27:50 -0400 Subject: [PATCH] fix: queries exports --- scripts/generate-queries.ts | 4 ++-- test/exports.test.ts | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 test/exports.test.ts diff --git a/scripts/generate-queries.ts b/scripts/generate-queries.ts index 7f33cb0..ee0797f 100644 --- a/scripts/generate-queries.ts +++ b/scripts/generate-queries.ts @@ -110,8 +110,8 @@ export const write = (filesystem = fs) => { `const path = require('path')\n` + // `const fs = require('fs')\n\n` + `exports.gitFunctionsPath = path.join(__dirname, 'create-git-functions.sql')\n\n` + - `exports.getGitFunctionsSql = () => fs.readFileSync(exports.createGitFunctionsPath, 'utf8')\n\n` + - `exports.getGitFunctionsSqlAsync = () => fs.promises.readFile(exports.createGitFunctionsPath, 'utf8')\n`, + `exports.getGitFunctionsSql = () => fs.readFileSync(exports.gitFunctionsPath, 'utf8')\n\n` + + `exports.getGitFunctionsSqlAsync = () => fs.promises.readFile(exports.gitFunctionsPath, 'utf8')\n`, 'utf8', ) filesystem.writeFileSync( diff --git a/test/exports.test.ts b/test/exports.test.ts new file mode 100644 index 0000000..59c5feb --- /dev/null +++ b/test/exports.test.ts @@ -0,0 +1,5 @@ +test('queries exports', async () => { + expect(require('../queries').gitFunctionsPath).toEqual(expect.any(String)) + expect(require('../queries').getGitFunctionsSql()).toEqual(expect.any(String)) + expect(await require('../queries').getGitFunctionsSqlAsync()).toEqual(expect.any(String)) +})