Skip to content

Commit

Permalink
Fix closing tokenizer (and therefor underlying file descriptor) in un…
Browse files Browse the repository at this point in the history
…it test
  • Loading branch information
Borewit committed Nov 26, 2024
1 parent 2a71150 commit 33341a2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/test-id3v2.3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,24 @@ import type { IGeneralEncapsulatedObject } from '../lib/id3v2/FrameParser.js';

describe('Extract metadata from ID3v2.3 header', () => {

it('should parse a raw ID3v2.3 header', () => {
it('should parse a raw ID3v2.3 header', async () => {

const filePath = path.join(samplePath, 'MusicBrainz - Beth Hart - Sinner\'s Prayer.id3v23');

const metadata = new MetadataCollector({});

return strtok.fromFile(filePath).then(tokenizer => {
return new ID3v2Parser().parse(metadata, tokenizer, {}).then(() => {
const tokenizer = await strtok.fromFile(filePath);
try {
return await new ID3v2Parser().parse(metadata, tokenizer, {}).then(() => {

assert.strictEqual(33, metadata.native['ID3v2.3'].length);

const id3v23 = mm.orderTags(metadata.native['ID3v2.3']);
assert.isDefined(id3v23.UFID, 'check if ID3v2.3-UFID is set');
});
});
} finally {
await tokenizer.close();
}
});

it('parse a ID3v2.3', async () => {
Expand Down

0 comments on commit 33341a2

Please sign in to comment.