[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
0

Configure Feed

Select the types of activity you want to include in your feed.

test(db): More db test improvements

FoxxMD (May 11, 2026, 4:56 PM UTC) f3a87911 b9db03f6

+10 -6
+10 -6
src/backend/tests/database/drizzle.test.ts
··· 32 32 await withLocalTmpDir(async () => { 33 33 const [db, isNew] = await getMigratedDb(getDbPath('notreal', process.cwd()), { loadDataDir: dataDir() }); 34 34 expect(isNew).is.true; 35 + db.$client.close(); 35 36 }, {postfix: 'noDb'}); 36 37 37 38 }); ··· 41 42 const db = await getDb(':memory:', { loadDataDir: dataDir() }); 42 43 const [shouldBackup, pending] = await shouldBackupDb(db); 43 44 expect(shouldBackup).is.true; 45 + db.$client.close(); 44 46 expect(pending).length(0); 45 47 46 48 }); ··· 71 73 path.resolve(projectDir, 'src/backend/common/database/drizzle/schema'), 72 74 '--dialect', 73 75 'postgresql' 74 - ]); 76 + ], {throwOnError: true}); 75 77 const [shouldBackup, pending] = await shouldBackupDb(db, { migrationsFolder: mf }); 76 78 expect(shouldBackup).is.true; 77 79 expect(pending).length(1); ··· 110 112 111 113 it('Backs up database when migrations are pending', async function () { 112 114 115 + // this can be slow due to all the io 116 + this.timout(5000); 117 + 113 118 const allFiles = await fs.readdir(path.resolve(projectDir, 'src/backend/common/database/drizzle/migrations')); 114 119 const migrationFiles = allFiles 115 120 .sort(); ··· 122 127 try { 123 128 await fs.cp(path.resolve(projectDir, `src/backend/common/database/drizzle/migrations/${migrationFiles[0]}`), path.resolve('./migrations/', migrationFiles[0]), { recursive: true }); 124 129 const mf = path.resolve('./migrations'); 125 - const db = await getDb(dbPath, {loadDataDir: dataDir()}); 126 - await migrateDb(db, { migrationsFolder: mf }); 130 + const [db, _] = await getMigratedDb(dbPath, {migrationsFolder: mf, loadDataDir: dataDir()}); 131 + await db.$client.close(); 127 132 const res = await x('drizzle-kit', [ 128 133 'generate', 129 134 '--name', ··· 135 140 path.resolve(projectDir, 'src/backend/common/database/drizzle/schema'), 136 141 '--dialect', 137 142 'postgresql' 138 - ]); 139 - db.$client.close(); 143 + ], {throwOnError: true}); 140 144 141 145 // add dummy data to migration so migrate() doesn't fail 142 146 const newMigrationFolder = (await fs.readdir(path.resolve('./migrations/'))).find(x => x.includes('newMigration')); 143 147 await fs.appendFile(path.resolve('./migrations/',newMigrationFolder, 'migration.sql'),`\nselect count(*) from plays;`); 144 148 145 - await getMigratedDb(dbPath, {workingDirectory: process.cwd(), migrationsFolder: mf}) 149 + await getMigratedDb(dbPath, {migrationsFolder: mf}); 146 150 const contents = await fs.readdir(path.resolve('./')); 147 151 const backupPattern = new RegExp(/msDb-\d+\.bak/) 148 152 expect(contents.some(x => backupPattern.test(x))).is.true;