-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a35a41e
commit 3360407
Showing
9 changed files
with
82 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const assert = require('node:assert'); | ||
const { describe, it } = require('node:test'); | ||
const fs = require('fs'); | ||
const { | ||
Version, | ||
convertSync, | ||
LogLevel, | ||
convert, | ||
Playlist, | ||
Converter | ||
} = require('../build/ireal-musicxml.cjs'); | ||
|
||
describe('ireal-musicxml using CommonJS', () => { | ||
it('accesses the library version', () => { | ||
assert.strictEqual(Version.name, 'ireal-musicxml'); | ||
}); | ||
|
||
it('converts an iReal Pro song to MusicXML synchronously', () => { | ||
const result = convertSync(fs.readFileSync('test/data/playlist.html', 'utf-8'), { | ||
notation: "rhythmic", | ||
logLevel: LogLevel.None | ||
}); | ||
assert.strictEqual(result.name, 'Jazz Combo'); | ||
assert.strictEqual(result.songs.length, 6); | ||
assert.notStrictEqual(result.songs[0].musicXml, ''); | ||
}); | ||
|
||
it('converts an iReal Pro song to MusicXML asynchronously', async () => { | ||
const result = await convert(fs.readFileSync('test/data/playlist.html', 'utf-8'), { | ||
notation: "slash", | ||
logLevel: LogLevel.Error | ||
}); | ||
assert.strictEqual(result.name, 'Jazz Combo'); | ||
assert.strictEqual(result.songs.length, 6); | ||
assert.notStrictEqual(result.songs[0].musicXml, ''); | ||
}); | ||
|
||
it('parses and exports a playlist manually', () => { | ||
const playlist = new Playlist(fs.readFileSync('test/data/playlist.html', 'utf-8')); | ||
assert.strictEqual(playlist.name, 'Jazz Combo') | ||
assert.strictEqual(playlist.songs.length, 6); | ||
const musicXml = Converter.convert(playlist.songs[0]); | ||
assert.notStrictEqual(musicXml, ''); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
import assert from 'node:assert'; | ||
import { describe, it } from 'node:test'; | ||
import fs from 'fs'; | ||
import * as iRealMusicXml from '../src/lib/index.js'; | ||
import { | ||
convertSync, | ||
convert, | ||
Playlist, | ||
Converter | ||
} from '../src/lib/index.js'; | ||
|
||
describe('iRealMusicXml', () => { | ||
describe('ireal-musicxml', () => { | ||
it('converts an iReal Pro song to MusicXML synchronously', () => { | ||
const result = iRealMusicXml.convertSync(fs.readFileSync('test/data/playlist.html', 'utf-8')); | ||
const result = convertSync(fs.readFileSync('test/data/playlist.html', 'utf-8')); | ||
assert.strictEqual(result.name, 'Jazz Combo') | ||
assert.strictEqual(result.songs.length, 6); | ||
assert.notStrictEqual(result.songs[0].musicXml, ''); | ||
}); | ||
|
||
it('converts an iReal Pro song to MusicXML asynchronously', async () => { | ||
const result = await iRealMusicXml.convert(fs.readFileSync('test/data/playlist.html', 'utf-8')); | ||
const result = await convert(fs.readFileSync('test/data/playlist.html', 'utf-8')); | ||
assert.strictEqual(result.name, 'Jazz Combo') | ||
assert.strictEqual(result.songs.length, 6); | ||
assert.notStrictEqual(result.songs[0].musicXml, ''); | ||
}); | ||
|
||
it('parses and exports a playlist manually', () => { | ||
const playlist = new iRealMusicXml.Playlist(fs.readFileSync('test/data/playlist.html', 'utf-8')); | ||
const playlist = new Playlist(fs.readFileSync('test/data/playlist.html', 'utf-8')); | ||
assert.strictEqual(playlist.name, 'Jazz Combo') | ||
assert.strictEqual(playlist.songs.length, 6); | ||
const musicXml = iRealMusicXml.Converter.convert(playlist.songs[0]); | ||
const musicXml = Converter.convert(playlist.songs[0]); | ||
assert.notStrictEqual(musicXml, ''); | ||
}); | ||
}); |