martijnversluis/ChordSheetJS

View on GitHub
test/chord_symbol/to_numeral_string.test.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Chord, Key } from '../../src';
import '../matchers';

describe('Chord', () => {
  describe('toNumeral', () => {
    describe('for a chord symbol', () => {
      it('returns a the numeral version', () => {
        const key = Key.parseOrFail('Ab');
        const parsedChord = Chord.parse('Dsus/F#');
        const numeral = parsedChord?.toNumeral(key);

        expect(numeral?.toString()).toEqual('bVsus/bVII');
      });

      it('accepts a string key', () => {
        expect(Chord.parse('Dsus/F#')?.toNumeral('Ab').toString()).toEqual('bVsus/bVII');
      });
    });
  });
});