feat: extracting the common readSQL function
This commit is contained in:
parent
370cccf8d9
commit
4af913cf30
10
test/helper.ts
Normal file
10
test/helper.ts
Normal 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());
|
||||
}
|
Loading…
Reference in New Issue
Block a user