bemusic/bemuse

Implement song folder deletion detection to make the automated test passing

dtinth opened this issue · 2 comments

Background

The recently-announced feature preview, Custom songs folder, is missing the ability to detect deleted songs.

There’s already an automated test for this functionality, but the test is disabled, because the functionality has not been implemented yet.

xit('detects deleted folders', async () => {
const folder: MockFolder = { song1, song2 }
const tester = new CustomFolderTestHarness()
await tester.setFolder(folder)
await tester.scan()
await tester.checkState(async (state) => {
expect(state.songs).to.have.length(2)
})
delete folder['song1']
await tester.scan()
await tester.checkState(async (state) => {
expect(state.songs).to.have.length(1)
})
})

Please help implement this feature, so that when a song for there is deleted, the game can detect it.

Task

  • Enable the test by changing xit to it. The test will fail. See below for how to run the test.

  • Implement folder deletion detection (more details about the functionality below). If it is correctly implemented, the test should be passing.

Learn about this functionality

  1. Download a BMS package an extract it to your computer. For an example BMS package that you can use, try downloading this package, which contains 6 songs: http://9domu46i.com/yuruyuru/phase14.html

  2. Go to https://bemuse.ninja/?mode=playground&playground=custom-folder

  3. Click Set custom songs folder and select the extracted folder.

  4. Click Scan to scan the folder. After it is done you should see: “Number of songs in the database: 6”

  5. Delete one of the song folders and click Scan again. The number should decrease, but right now it doesn’t, because that is no code to detect deletion of the folder yet. Please implement this.

How to test this feature

  1. Run the development server. See README file.

  2. Go to http://localhost:8080/?mode=test&grep=custom-folder to run the tests.

Hacktoberfest

If you would like to work on this task, please write a comment stating your intent. We will then assign the issue to you. To ensure continuity, the issue will be unassigned after 3 days of inactivity — so please keep us updated.

I intend to implement this feature

@fResult Yours now, thank you for taking this issue! 🙏