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

View file

@ -8,18 +8,26 @@ import extendExpect from '@testing-library/jest-dom/extend-expect'
it('renders SoundChangeSuite without crashing', () => {
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);
});
describe('SoundChangeSuite', () => {
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');
});
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'})
})
});