Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
notesInRandomChord() {
let degree = 1 + this.generator.int() % this.scale.steps.length
let steps = this.scale.buildChordSteps(degree, 3) // seven chords
let chord = new Chord(this.scale.degreeToName(degree), steps)
this.lastChord = chord
return this.notes.filter(n => chord.containsNote(n))
}
it("gets the chord name of a m chord", function() {
let chord = new Chord("E", "m");
expect(chord.chordShapeName()).toBe("m")
})
it("checks if chords are dominant", function() {
expect(new Chord("A", "m7b5").isDominant()).toBe(false)
expect(new Chord("F#", "7").isDominant()).toBe(true)
expect(new Chord("G", "M").isDominant()).toBe(true)
expect(new Chord("G", "m").isDominant()).toBe(false)
})
it("gets the chord name of a 7 chord", function() {
let chord = new Chord("F", "7");
expect(chord.chordShapeName()).toBe("7")
})
it("gets all chords for scale", function() {
let generator = new ChordGenerator(new KeySignature(0))
let chords = generator.allChords()
expect(chords).toEqual([
new Chord("C", "M"),
new Chord("D", "m"),
new Chord("E", "m"),
new Chord("F", "M"),
new Chord("G", "M"),
new Chord("A", "m"),
new Chord("B", "dim"),
])
})
it("gets the chord name of a m7 chord", function() {
let chord = new Chord("G", "m7");
expect(chord.chordShapeName()).toBe("m7")
})
it("gets all chords for scale", function() {
let generator = new ChordGenerator(new KeySignature(0))
let chords = generator.allChords()
expect(chords).toEqual([
new Chord("C", "M"),
new Chord("D", "m"),
new Chord("E", "m"),
new Chord("F", "M"),
new Chord("G", "M"),
new Chord("A", "m"),
new Chord("B", "dim"),
])
})
it("gets the chord name of a M7 chord", function() {
let chord = new Chord("C", "M7");
expect(chord.chordShapeName()).toBe("M7")
})
it("gets the chord name of a m7b5 chord", function() {
let chord = new Chord("A", "m7b5");
expect(chord.chordShapeName()).toBe("m7b5")
})
})
it("gets all chords for scale", function() {
let generator = new ChordGenerator(new KeySignature(0))
let chords = generator.allChords()
expect(chords).toEqual([
new Chord("C", "M"),
new Chord("D", "m"),
new Chord("E", "m"),
new Chord("F", "M"),
new Chord("G", "M"),
new Chord("A", "m"),
new Chord("B", "dim"),
])
})