From ce8d01a7b4f3ced29959713ff3ca6d39490f0d94 Mon Sep 17 00:00:00 2001 From: Sorrel Bri Date: Wed, 4 Dec 2019 22:30:39 -0800 Subject: [PATCH] stub state init function to test run changes --- src/reducers/stateReducer.js | 87 ++++++++++++++++++++--- src/reducers/stateReducer.results.test.js | 18 +++++ 2 files changed, 96 insertions(+), 9 deletions(-) create mode 100644 src/reducers/stateReducer.results.test.js diff --git a/src/reducers/stateReducer.js b/src/reducers/stateReducer.js index ec03ac3..5de9264 100644 --- a/src/reducers/stateReducer.js +++ b/src/reducers/stateReducer.js @@ -1,12 +1,3 @@ -export const initState = () => { - return { - epochs: [], - lexicon: [], - phones: {}, - features: {} - } -} - const addPhones = (phones, phone) => { let node = {}; phone.split('').forEach((graph, index) => { @@ -110,4 +101,82 @@ export const stateReducer = (state, action) => { default: return state; } +} + +export const initState = () => { + const state = { + epochs: [ + { + name: 'epoch 1', + changes: [ + '[+ occlusive - nasal]>[+ occlusive nasal]/n_', + 'at>ta/_#', + '[+ sonorant - low rounded high back]>_/_', + 'nn>nun/_', + '[+ nasal][+ obstruent]>[+ nasal obstruent aspirated ]/#_', + '[+ sonorant rounded]>[+ sonorant - rounded]/_#' + ] + } + ], + lexicon: [ + 'anta', 'anat', 'anət', 'anna', 'tan', 'ənta' + ], + phones: { + a: { + grapheme: 'a', features: { + sonorant: true, back: true, low: true, high: false, rounded: false + } + }, + u: { + grapheme: 'u', features: { + sonorant: true, back: true, low: false, high: true, rounded: true, + } + }, + ɯ: { + grapheme: 'ɯ', features: { + sonorant: true, back: true, low: false, high: true, rounded: false, + } + }, + ə: { + grapheme: 'ə', features: { + sonorant: true, low: false, rounded: false, high: false, back: false + } + }, + t: { + grapheme: 't', features: { + occlusive: true, coronal: true, obstruent: true + } + }, + n: { + grapheme: 'a', features: { + sonorant: true, nasal: true, occlusive: true, coronal: true + }, + t: { + ʰ: { + grapheme: 'ntʰ', features: { + occlusive: true, nasal: true, coronal: true, obstruent: true, aspirated: true + } + } + } + } + }, + options: {}, + results: {}, + errors: {}, + features: {} + }; + state.features = { + sonorant: { positive:[ state.phones.a, state.phones.u, state.phones.ɯ, state.phones.ə, state.phones.n], negative: [] }, + back: { positive:[ state.phones.a, state.phones.u, state.phones.ɯ ], negative: [ state.phones.ə ] }, + low: { positive:[ state.phones.a ], negative: [ state.phones.u, state.phones.ɯ, state.phones.ə ] }, + high: { positive:[ state.phones.u, state.phones.ɯ ], negative: [ state.phones.a, state.phones.ə ] }, + rounded: { positive:[ state.phones.u ], negative: [ state.phones.a, state.phones.ɯ, state.phones.ə ] }, + occlusive: { positive:[ state.phones.t, state.phones.n, state.phones.n.t.ʰ ], negative: [] }, + coronal: { positive:[ state.phones.t, state.phones.n, state.phones.n.t.ʰ ], negative: [] }, + obstruent: { positive:[ state.phones.t, state.phones.n, state.phones.n.t.ʰ ], negative: [] }, + nasal: { positive:[ state.phones.n ], negative: [] }, + aspirated: { positive:[ state.phones.n.t.ʰ ], negative: [] }, + } + + return state; } \ No newline at end of file diff --git a/src/reducers/stateReducer.results.test.js b/src/reducers/stateReducer.results.test.js new file mode 100644 index 0000000..714fe7d --- /dev/null +++ b/src/reducers/stateReducer.results.test.js @@ -0,0 +1,18 @@ +import {stateReducer, initState} from './stateReducer'; + +describe('Results', () => { + let state = {}; + beforeEach(()=> { + state = initState(); + }) + + it('results returned unaltered', () => { + const action = {type: ''}; + expect(stateReducer(state, action)).toBe(state); + }); + + it('results returned from test cases', () => { + + }) + +}); \ No newline at end of file