Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions my-chords-tester/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ChordBlock from '@tombatossals/react-chords/lib/Chord/ChordBlock'
import guitarChords from '@tombatossals/chords-db/lib/guitar.json';
import ukuleleChords from '@tombatossals/chords-db/lib/ukulele.json';
import pianoChords from '@tombatossals/chords-db/lib/piano.json';
import cavaquinhoChords from '@tombatossals/chords-db/lib/cavaquinho.json';
import { addMidiToPosition } from '@tombatossals/react-chords/lib/Chord/midiUtils';
import './App.css';

Expand Down Expand Up @@ -46,6 +47,19 @@ const instruments = {
standard: []
}
}
},
cavaquinho: {
name: 'Cavaquinho',
chords: cavaquinhoChords,
config: {
strings: 4,
fretsOnChord: 4,
name: 'Cavaquinho',
keys: [],
tunings: {
standard: ['D', 'G', 'B', 'D']
}
}
}
};

Expand Down
30 changes: 26 additions & 4 deletions my-chords-tester/src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
import { render, screen } from '@testing-library/react';
import App from './App';
import { BrowserRouter } from 'react-router-dom';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
describe('Cavaquinho Instrument Support', () => {
test('renders all instruments including cavaquinho', () => {
render(
<BrowserRouter>
<App />
</BrowserRouter>
);

expect(screen.getByText('Guitar')).toBeInTheDocument();
expect(screen.getByText('Ukulele')).toBeInTheDocument();
expect(screen.getByText('Piano')).toBeInTheDocument();
expect(screen.getByText('Cavaquinho')).toBeInTheDocument();
});

test('cavaquinho is navigable', () => {
render(
<BrowserRouter>
<App />
</BrowserRouter>
);

const cavaquinhoLink = screen.getByText('Cavaquinho');
expect(cavaquinhoLink).toBeInTheDocument();
expect(cavaquinhoLink.closest('a')).toHaveAttribute('href', '/cavaquinho');
});
});