patch failing SoundChangeSuite tests

This commit is contained in:
Sorrel Bri 2019-12-20 13:59:23 -08:00
parent 26d85eec4c
commit 2d207c4783
2 changed files with 19 additions and 11 deletions

View file

@ -21,7 +21,6 @@ const PhonoChangeApplier = () => {
// ! DONE // ! DONE
const [ lexicon, setLexicon ] = useState(['mun', 'tʰu', 'tɯm', 'utʰ']); const [ lexicon, setLexicon ] = useState(['mun', 'tʰu', 'tɯm', 'utʰ']);
// ! UNDONE
const [ phonemes, setPhonemes ] = useState( const [ phonemes, setPhonemes ] = useState(
{ {
n: [ 'occlusive', 'sonorant', 'obstruent', 'nasal', 'alveolar' ], n: [ 'occlusive', 'sonorant', 'obstruent', 'nasal', 'alveolar' ],
@ -31,14 +30,15 @@ const PhonoChangeApplier = () => {
t: [ 'occlusive', 'plosive', 'obstruent', 'alveolar' ], t: [ 'occlusive', 'plosive', 'obstruent', 'alveolar' ],
: [ 'occlusive', 'plosive', 'obstruent', 'alveolar', 'aspirated' ], : [ 'occlusive', 'plosive', 'obstruent', 'alveolar', 'aspirated' ],
} }
); );
const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ rounded]>[- rounded + unrounded]/_#']}]); const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ rounded]>[- rounded + unrounded]/_#']}]);
const [ options, setOptions ] = useState({output: 'default', save: false}) const [ options, setOptions ] = useState({output: 'default', save: false})
const [ features, setFeatures ] = useState(
['occlusive', 'sonorant', 'obstruent', 'nasal', 'alveolar','bilabial',
'continuant','syllabic','high','back','rounded','unrounded', 'plosive','aspirated'])
// ! UNDONE
const [ results, setResults ] = useState([]) const [ results, setResults ] = useState([])
const [ errors, setErrors ] = useState({}) const [ errors, setErrors ] = useState({})
const [ features, setFeatures ] = useState(
['occlusive', 'sonorant', 'obstruent', 'nasal', 'alveolar','bilabial',
'continuant','syllabic','high','back','rounded','unrounded', 'plosive','aspirated'])
const runChanges = e => { const runChanges = e => {
e.preventDefault(); e.preventDefault();

View file

@ -8,18 +8,26 @@ import extendExpect from '@testing-library/jest-dom/extend-expect'
it('renders SoundChangeSuite without crashing', () => { it('renders SoundChangeSuite without crashing', () => {
const div = document.createElement('div'); const div = document.createElement('div');
ReactDOM.render(<SoundChangeSuite />, div); ReactDOM.render(<SoundChangeSuite epoch={{name:'Epoch Name', changes:['sound change rule']}} updateEpoch={()=>{}} removeEpoch={()=>{}}/>, div);
ReactDOM.unmountComponentAtNode(div); ReactDOM.unmountComponentAtNode(div);
}); });
describe('SoundChangeSuite', () => { describe('SoundChangeSuite', () => {
it('renders the correct subtitle', () => { it('renders the correct subtitle', () => {
const { getByTestId } = render(<SoundChangeSuite epoch={{name:'Epoch Name', changes:['sound change rule']}}/>); const { getByTestId } = render(
<SoundChangeSuite epoch={{name:'Epoch Name', changes:['sound change rule']}}
updateEpoch={()=>{}} removeEpoch={()=>{}}
/>
);
expect(getByTestId('Epoch Name_SoundChangeSuite')).toHaveTextContent('Epoch Name'); expect(getByTestId('Epoch Name_SoundChangeSuite')).toHaveTextContent('Epoch Name');
}); });
it('renders a suite of soundchanges', () => { it('renders a suite of soundchanges', () => {
const { getByTestId } = render(<SoundChangeSuite epoch={{name:'Epoch Name', changes:['sound>change/environment']}}/>); const { getByTestId } = render(
<SoundChangeSuite epoch={{name:'Epoch Name', changes:['sound>change/environment']}}
updateEpoch={()=>{}} removeEpoch={()=>{}}
/>
);
expect(getByTestId('Epoch Name_SoundChangeSuite_changes')).toHaveFormValues({changes: 'sound>change/environment'}) expect(getByTestId('Epoch Name_SoundChangeSuite_changes')).toHaveFormValues({changes: 'sound>change/environment'})
}) })
}); });