|
1 | 1 | import { Chord } from '../../src';
|
2 | 2 | import SUFFIX_MAPPING from '../../src/normalize_mappings/suffix-normalize-mapping';
|
| 3 | +import Key from '../../src/key'; |
| 4 | + |
| 5 | +const keys: Set<string> = new Set<string>(); |
| 6 | +const baseKey = Key.parse('A')!; |
| 7 | + |
| 8 | +for (let i = 0; i < 12; i += 1) { |
| 9 | + keys.add(baseKey.transpose(i).toString()); |
| 10 | + keys.add(baseKey.transpose(i).useModifier('#').toString()); |
| 11 | + keys.add(baseKey.transpose(i).useModifier('b').toString()); |
| 12 | + keys.add(baseKey.transpose(i).toNumeralString(baseKey)); |
| 13 | + keys.add(baseKey.transpose(i).useModifier('#').toNumeralString(baseKey)); |
| 14 | + keys.add(baseKey.transpose(i).useModifier('b').toNumeralString(baseKey)); |
| 15 | + keys.add(baseKey.transpose(i).toNumericString(baseKey)); |
| 16 | + keys.add(baseKey.transpose(i).useModifier('#').toNumericString(baseKey)); |
| 17 | + keys.add(baseKey.transpose(i).useModifier('b').toNumericString(baseKey)); |
| 18 | +} |
3 | 19 |
|
4 | 20 | describe('Chord', () => {
|
5 | 21 | describe('#parse', () => {
|
6 |
| - const base = 'Eb'; |
7 |
| - |
8 |
| - Object |
9 |
| - .keys(SUFFIX_MAPPING) |
10 |
| - .filter((suffix) => suffix !== '[blank]') |
11 |
| - .forEach((suffix) => { |
12 |
| - const chord = `${base}${suffix}`; |
| 22 | + keys.forEach((base) => { |
| 23 | + Object |
| 24 | + .keys(SUFFIX_MAPPING) |
| 25 | + .filter((suffix) => suffix !== '[blank]') |
| 26 | + .forEach((suffix) => { |
| 27 | + const chord = `${base}${suffix}`; |
13 | 28 |
|
14 |
| - it(`parses ${chord}`, () => { |
15 |
| - expect(Chord.parse(chord)?.toString()).toEqual(chord); |
| 29 | + it(`parses ${chord}`, () => { |
| 30 | + expect(Chord.parseOrFail(chord).toString()).toEqual(chord); |
| 31 | + }); |
16 | 32 | });
|
17 |
| - }); |
| 33 | + }); |
18 | 34 | });
|
19 | 35 | });
|
0 commit comments