UNPKG

12tet

Version:

Music theory library for generating and working with chords, modes, intervals, etc.

45 lines (44 loc) 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const interval_1 = require("../../src/interval"); describe('Test getInterval function', () => { test('Execute getInterval function with shortName', () => { const p8 = (0, interval_1.interval)('P8'); if ((0, interval_1.isInterval)(p8)) { expect(p8.name).toStrictEqual('Perfect Octave'); } else { fail('getInterval returned unexpected TypeError'); } }); test('Execute getInterval function with name', () => { const p8 = (0, interval_1.interval)('Perfect Octave'); if ((0, interval_1.isInterval)(p8)) { expect(p8.name).toStrictEqual('Perfect Octave'); } else { fail('getInterval returned unexpected TypeError'); } }); test('Execute getInterval function with interval distance', () => { const p8 = (0, interval_1.interval)(12); if ((0, interval_1.isInterval)(p8)) { expect(p8.name).toStrictEqual('Perfect Octave'); } else { fail('getInterval returned unexpected TypeError'); } }); test('Execute getInterval function with complex interval distance', () => { const p8 = (0, interval_1.interval)(24); if ((0, interval_1.isInterval)(p8)) { expect(p8.name).toStrictEqual('Perfect Octave'); } else { fail('getInterval returned unexpected TypeError'); } }); // test('Execute getInterval function with bad interval identifier', () => { // expect(interval('wrong' as IntervalIdentifier)).toThrow(TypeError(`Could not find interval with distance wrong`)) // }) });