Skip to content

Commit b38dbf0

Browse files
add test for initSQLFilePath option
1 parent 43cf40e commit b38dbf0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/versions.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ const arch = process.arch === 'x64' || (process.platform === 'win32' && process.
1818
const versionRequirement = process.env.VERSION_REQUIREMENT || '>0.0.0'
1919
console.log('Running versions test with versionRequirement:', versionRequirement)
2020

21+
const initSQLFilePath = `${os.tmpdir()}/mysqlmsn-init-file-${crypto.randomUUID()}`
22+
fs.writeFileSync(initSQLFilePath, 'CREATE DATABASE initfromsqlfilepath;', 'utf-8')
23+
2124
for (const version of DOWNLOADABLE_MYSQL_VERSIONS.filter(v => satisfies(v, versionRequirement))) {
2225
try {
2326
getBinaryURL(version, arch)
@@ -35,7 +38,8 @@ for (const version of DOWNLOADABLE_MYSQL_VERSIONS.filter(v => satisfies(v, versi
3538
logLevel: 'LOG',
3639
initSQLString: 'CREATE DATABASE mytestdb;',
3740
arch,
38-
xEnabled: process.env.X_OFF === 'true' ? 'OFF' : 'FORCE'
41+
xEnabled: process.env.X_OFF === 'true' ? 'OFF' : 'FORCE',
42+
initSQLFilePath
3943
}
4044

4145
const db = await createDB(options)
@@ -49,6 +53,9 @@ for (const version of DOWNLOADABLE_MYSQL_VERSIONS.filter(v => satisfies(v, versi
4953

5054
//If this does not fail, it means initSQLString works as expected and the database was successfully created.
5155
await connection.query('USE mytestdb;')
56+
57+
//If this does not fail, it means initSQLFilePath works as expected and the database was successfully created.
58+
await connection.query('USE initfromsqlfilepath;')
5259

5360
await connection.end();
5461
await db.stop();

0 commit comments

Comments
 (0)