-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from Phuire-Research/UI
UI
- Loading branch information
Showing
5 changed files
with
68 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Concepts, createConcept } from '../model/concept'; | ||
import { KeyedSelector, createUnifiedKeyedSelector, selectSlice } from '../model/selector'; | ||
|
||
export type BaseDataSet = { | ||
prompt: string, | ||
content: string, | ||
} | ||
|
||
export type NamedDataSet = { | ||
name: string, | ||
dataSet: BaseDataSet[] | ||
} | ||
|
||
export const generateBaseDataSetEntry = (): BaseDataSet => { | ||
return { | ||
prompt: '#insert prompt#', | ||
content: '#insert chosen output#', | ||
}; | ||
}; | ||
|
||
export const generateDefaultNamedDataSet = (name: string): NamedDataSet => ({ | ||
name, | ||
dataSet: [generateBaseDataSetEntry()] | ||
}); | ||
|
||
test('userInterfaceBindingsToString', (done) => { | ||
const simulated = { | ||
trainingData: [generateDefaultNamedDataSet('something')], | ||
shallow: true, | ||
}; | ||
const experiment = createConcept( | ||
'experiment', | ||
simulated | ||
); | ||
const concepts: Concepts = { | ||
1: experiment | ||
}; | ||
const entry = generateBaseDataSetEntry(); | ||
const selector = createUnifiedKeyedSelector(concepts, 1, 'trainingData 0 dataSet 0 prompt') as KeyedSelector; | ||
const shallow = createUnifiedKeyedSelector(concepts, 1, 'shallow') as KeyedSelector; | ||
const getUndefined = {...selector}; | ||
getUndefined.conceptName = 'something'; | ||
expect(selectSlice(concepts, selector)).toBe(entry.prompt); | ||
expect(selectSlice(concepts, shallow)).toBe(true); | ||
expect(selectSlice(concepts, getUndefined)).toBe(undefined); | ||
done(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters