feat: extracting the common readSQL function

This commit is contained in:
wewoor 2023-05-11 18:11:12 +08:00
parent 370cccf8d9
commit 4af913cf30

10
test/helper.ts Normal file
View File

@ -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());
}