1
0
Fork 0

chore: Test updates

There was an issue in the pattern tests that meant
config options where skipped as soon as a static
number of string was encountered

I've also added testing for non-human models (dolls, giants)
as it seems some patterns to not pass the antperson test
so this would be a way to catch that (and enforce it)
This commit is contained in:
joostdecock 2021-09-11 15:50:32 +02:00
parent 11d8640fc8
commit b3fdac8c8c
3 changed files with 73 additions and 4 deletions

View file

@ -73,7 +73,7 @@ const testPatternSampling = (design, Pattern, expect, models, patterns) => {
/*
* Sample pattern for different models
*/
it('Sample pattern for different models:' , () => {
it('Sample pattern for size range:' , () => {
expect(doesItSample(new Pattern({
sample: {
type: 'models',
@ -84,6 +84,40 @@ const testPatternSampling = (design, Pattern, expect, models, patterns) => {
})
}
if (['rendertest', 'tutorial', 'examples'].indexOf(design) === -1) {
/*
* Sample pattern with fractional sizes (antperson tests)
*/
const fractionModel = fraction => {
const model = {}
for (const [measie, value] of Object.entries(ourModels.size40)) {
model[measie] = value * fraction
}
return model
}
const models = {
oneTenth: fractionModel(0.1),
oneFifth: fractionModel(0.2),
oneHalf: fractionModel(0.5),
threeQuarters: fractionModel(0.5),
oneFifty: fractionModel(1.5),
twoFifty: fractionModel(2.5),
five: fractionModel(5),
ten: fractionModel(10),
}
it('Sample pattern for fantastic measurements:' , () => {
expect(doesItSample(new Pattern({
sample: {
type: 'models',
models,
},
measurements
}))).to.equal(true)
})
}
}
module.exports = testPatternSampling