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

@ -41,7 +41,7 @@ const testPatternDrafting = (design, Pattern, expect, models, patterns) => {
* Draft pattern for different models
*/
if (isGarment(design)) {
it('Draft for different models:', () => true)
it('Draft for human models:', () => true)
for (let size in ourModels) {
it(` - Drafting for ${size} (${breasts ? 'with' : 'no'} breasts)`, () => {
@ -54,6 +54,39 @@ const testPatternDrafting = (design, Pattern, expect, models, patterns) => {
).to.equal(true)
})
}
// Do the same for fantistical models (dolls, giants)
it('Draft for non-human models:', () => true)
const fractionModel = fraction => {
const model = {}
for (const [measie, value] of Object.entries(ourModels.size40)) {
model[measie] = value * fraction
}
return model
}
const models = {
// These are just names, don't read too much into it
'Gnome (0.1)': fractionModel(0.1),
'Halfling (0.2)': fractionModel(0.2),
'Goblin (0.5)': fractionModel(0.5),
'Dwarf (0.75)': fractionModel(0.75),
'Elf (1.5)': fractionModel(1.5),
'Ogre (2.5)': fractionModel(2.5),
'Firbolg (5)': fractionModel(5),
}
for (let size in models) {
it(` - Drafting for ${size} (${breasts ? 'with' : 'no'} breasts)`, () => {
expect(
doesItDraft(
new Pattern({
measurements: models[size]
})
)
).to.equal(true)
})
}
}