From 4af913cf301d61e7ce9652cf47669bfa87a6b84b Mon Sep 17 00:00:00 2001 From: wewoor Date: Thu, 11 May 2023 18:11:12 +0800 Subject: [PATCH] feat: extracting the common readSQL function --- test/helper.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/helper.ts diff --git a/test/helper.ts b/test/helper.ts new file mode 100644 index 0000000..1062e67 --- /dev/null +++ b/test/helper.ts @@ -0,0 +1,10 @@ +import fs from 'fs'; +import path from 'path'; + +export const readSQL = (dirname: string, fileName: string, isSegment = true) => { + const sqlFiles = fs.readFileSync(path.join(dirname, 'fixtures', fileName), 'utf-8') + if (!isSegment) return [sqlFiles]; + return sqlFiles.split(';') + .filter(Boolean) + .map((i) => i.trim()); +} \ No newline at end of file