chore: Added more unittests for patterns
This commit is contained in:
parent
13c4cbd779
commit
926e921582
39 changed files with 818 additions and 6 deletions
|
@ -4,6 +4,12 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
### utils
|
||||
|
||||
#### Changed
|
||||
|
||||
- neckstimate() now returns values rounded to nearest mm
|
||||
|
||||
|
||||
## 2.4.4 (2020-03-15)
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ Unreleased:
|
|||
date:
|
||||
Added:
|
||||
Changed:
|
||||
utils:
|
||||
- neckstimate() now returns values rounded to nearest mm
|
||||
Deprecated:
|
||||
Fixed:
|
||||
Removed:
|
||||
|
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const {{ Pattern }} = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'{{ pattern }}',
|
||||
{{ Pattern }},
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'{{ pattern }}',
|
||||
{{ Pattern }},
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Aaron = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'aaron',
|
||||
Aaron,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'aaron',
|
||||
Aaron,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Benjamin = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'benjamin',
|
||||
Benjamin,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'benjamin',
|
||||
Benjamin,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Bent = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'bent',
|
||||
Bent,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'bent',
|
||||
Bent,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Breanna = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'breanna',
|
||||
Breanna,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'breanna',
|
||||
Breanna,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Brian = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'brian',
|
||||
Brian,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'brian',
|
||||
Brian,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Bruce = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'bruce',
|
||||
Bruce,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'bruce',
|
||||
Bruce,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Carlita = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'carlita',
|
||||
Carlita,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'carlita',
|
||||
Carlita,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Carlton = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'carlton',
|
||||
Carlton,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'carlton',
|
||||
Carlton,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Cathrin = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'cathrin',
|
||||
Cathrin,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'cathrin',
|
||||
Cathrin,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -182,7 +182,7 @@ Svg.prototype.renderPathText = function(path) {
|
|||
let svg = this.nl() + '<text>'
|
||||
this.indent()
|
||||
svg += `<textPath xlink:href="#${path.attributes.get('id')}" ${offset}><tspan ${attributes}>${
|
||||
this.escapteText(this.text)
|
||||
this.escapeText(this.text)
|
||||
}</tspan></textPath>`
|
||||
this.outdent()
|
||||
svg += this.nl() + '</text>'
|
||||
|
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Examples = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'examples',
|
||||
Examples,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'examples',
|
||||
Examples,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Florent = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'florent',
|
||||
Florent,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'florent',
|
||||
Florent,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Fu = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'fu',
|
||||
Fu,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'fu',
|
||||
Fu,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Holmes = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'holmes',
|
||||
Holmes,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'holmes',
|
||||
Holmes,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Huey = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'huey',
|
||||
Huey,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'huey',
|
||||
Huey,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Hugo = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'hugo',
|
||||
Hugo,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'hugo',
|
||||
Hugo,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Jaeger = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'jaeger',
|
||||
Jaeger,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'jaeger',
|
||||
Jaeger,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Penelope = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'penelope',
|
||||
Penelope,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'penelope',
|
||||
Penelope,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Rendertest = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'rendertest',
|
||||
Rendertest,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'rendertest',
|
||||
Rendertest,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Sandy = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'sandy',
|
||||
Sandy,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'sandy',
|
||||
Sandy,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Shin = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'shin',
|
||||
Shin,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'shin',
|
||||
Shin,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Simon = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'simon',
|
||||
Simon,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'simon',
|
||||
Simon,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Simone = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'simone',
|
||||
Simone,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'simone',
|
||||
Simone,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Sven = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'sven',
|
||||
Sven,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'sven',
|
||||
Sven,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Tamiko = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'tamiko',
|
||||
Tamiko,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'tamiko',
|
||||
Tamiko,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Theo = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'theo',
|
||||
Theo,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'theo',
|
||||
Theo,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Trayvon = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'trayvon',
|
||||
Trayvon,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'trayvon',
|
||||
Trayvon,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Tutorial = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'tutorial',
|
||||
Tutorial,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'tutorial',
|
||||
Tutorial,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
**Note:** Version bump only for package utils
|
||||
|
||||
### Changed
|
||||
|
||||
- neckstimate() now returns values rounded to nearest mm
|
||||
## 2.4.4 (2020-03-15)
|
||||
|
||||
**Note:** Version bump only for package utils
|
||||
|
|
|
@ -31,7 +31,7 @@ const neckstimate = (neckCircumference = false, measurement = false, breasts = f
|
|||
// This is what should happen
|
||||
let delta = (neckCircumference / data.neckCircumference) * data[measurement] - data[measurement]
|
||||
|
||||
return data[measurement] + delta * ratio[measurement]
|
||||
return Math.round(data[measurement] + delta * ratio[measurement])
|
||||
}
|
||||
|
||||
export default neckstimate
|
||||
|
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Wahid = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'wahid',
|
||||
Wahid,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'wahid',
|
||||
Wahid,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -5,7 +5,11 @@ const models = require("@freesewing/models")
|
|||
const patterns = require("@freesewing/pattern-info")
|
||||
|
||||
const Waralee = require('../dist')
|
||||
|
||||
// Shared tests
|
||||
const testPatternConfig = require('../../../tests/patterns/config')
|
||||
const testPatternDrafting = require('../../../tests/patterns/drafting')
|
||||
const testPatternSampling = require('../../../tests/patterns/sampling')
|
||||
|
||||
// Test config
|
||||
testPatternConfig(
|
||||
|
@ -15,3 +19,21 @@ testPatternConfig(
|
|||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test drafting
|
||||
testPatternDrafting(
|
||||
'waralee',
|
||||
Waralee,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
||||
|
||||
// Test sampling
|
||||
testPatternSampling(
|
||||
'waralee',
|
||||
Waralee,
|
||||
expect,
|
||||
models,
|
||||
patterns
|
||||
)
|
|
@ -482,7 +482,7 @@ function configurePatternUnitTests(pkg, config) {
|
|||
peerdeps: Object.keys(peerDependencies(pkg, config, 'pattern')).join(' ')
|
||||
};
|
||||
|
||||
for (let file of ["config.test.js"]) {
|
||||
for (let file of ["shared.test.js"]) {
|
||||
fs.writeFileSync(
|
||||
path.join(dest, file),
|
||||
Mustache.render(
|
||||
|
|
|
@ -11,7 +11,7 @@ for d in ../packages/*/ ; do {
|
|||
cd $d
|
||||
# do something here
|
||||
pwd
|
||||
npm run build
|
||||
rm -rf report
|
||||
cd ..
|
||||
}
|
||||
done
|
||||
|
|
63
tests/patterns/drafting.js
Normal file
63
tests/patterns/drafting.js
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* This runs unit tests for pattern drafting
|
||||
* It expects the following:
|
||||
*
|
||||
* @param string me: Name of the pattern (eg 'aaron')
|
||||
* @param object Pattern: pattern constructor
|
||||
*
|
||||
* @param object expect: Imported chai.expect
|
||||
* @param object models: Imported @freesewing/models
|
||||
* @param object patterns: Imported @freesewing/pattern-info
|
||||
*/
|
||||
const testPatternDrafting = (design, Pattern, expect, models, patterns) => {
|
||||
|
||||
// Helper method to try/catch pattern drafting
|
||||
const doesItDraft = pattern => {
|
||||
try {
|
||||
pattern.draft()
|
||||
return true
|
||||
}
|
||||
catch (err) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Figure out whether this is a with(out)breasts pattern
|
||||
const breasts = (patterns.withBreasts.indexOf(design) === -1) ? false : true
|
||||
|
||||
const ourModels = models
|
||||
[breasts ? 'withBreasts' : 'withoutBreasts']
|
||||
const measurements = ourModels
|
||||
[breasts ? 'size34' : 'size42']
|
||||
|
||||
/*
|
||||
* Draft pattern for different models
|
||||
*/
|
||||
it('Draft for different models:' , () => true)
|
||||
|
||||
for (let size in ourModels) {
|
||||
it(` - Drafting for ${size} (${breasts ? 'with':'no'} breasts)`, () => {
|
||||
expect(doesItDraft(new Pattern({
|
||||
measurements: ourModels[size],
|
||||
}))).to.equal(true)
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
* Draft parts individually
|
||||
*/
|
||||
it('Draft parts individually:' , () => true)
|
||||
|
||||
for (let name of patterns.parts[design]) {
|
||||
it(` - ${name} should draft on its own`, () => {
|
||||
expect(doesItDraft(new Pattern({
|
||||
measurements,
|
||||
settings: {
|
||||
only: [name]
|
||||
}
|
||||
}))).to.equal(true)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = testPatternDrafting
|
81
tests/patterns/sampling.js
Normal file
81
tests/patterns/sampling.js
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* This runs unit tests for pattern sampling
|
||||
* It expects the following:
|
||||
*
|
||||
* @param string me: Name of the pattern (eg 'aaron')
|
||||
* @param object Pattern: pattern constructor
|
||||
*
|
||||
* @param object expect: Imported chai.expect
|
||||
* @param object models: Imported @freesewing/models
|
||||
* @param object patterns: Imported @freesewing/pattern-info
|
||||
*/
|
||||
const testPatternSampling = (design, Pattern, expect, models, patterns) => {
|
||||
|
||||
// Helper method to try/catch pattern sampling
|
||||
const doesItSample = pattern => {
|
||||
try {
|
||||
pattern.sample()
|
||||
return true
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Figure out whether this is a with(out)breasts pattern
|
||||
const breasts = (patterns.withBreasts.indexOf(design) === -1) ? false : true
|
||||
|
||||
const ourModels = models
|
||||
[breasts ? 'withBreasts' : 'withoutBreasts']
|
||||
const measurements = ourModels
|
||||
[breasts ? 'size34' : 'size42']
|
||||
|
||||
/*
|
||||
* Sample different measurements
|
||||
*/
|
||||
it('Sample different measurements:' , () => true)
|
||||
for (let measurement of Pattern.config.measurements) {
|
||||
it(` Sample ${measurement}:` , () => {
|
||||
expect(doesItSample(new Pattern({
|
||||
sample: {
|
||||
type: 'measurement',
|
||||
measurement
|
||||
},
|
||||
measurements
|
||||
}))).to.equal(true)
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
* Sample different options
|
||||
*/
|
||||
it('Sample different options:' , () => true)
|
||||
for (let option in Pattern.config.options) {
|
||||
it(` Sample ${option}:` , () => {
|
||||
expect(doesItSample(new Pattern({
|
||||
sample: {
|
||||
type: 'option',
|
||||
option
|
||||
},
|
||||
measurements
|
||||
}))).to.equal(true)
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
* Sample pattern for different models
|
||||
*/
|
||||
it('Sample pattern for different models:' , () => {
|
||||
expect(doesItSample(new Pattern({
|
||||
sample: {
|
||||
type: 'models',
|
||||
models: ourModels,
|
||||
},
|
||||
measurements
|
||||
}))).to.equal(true)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
module.exports = testPatternSampling
|
Loading…
Add table
Add a link
Reference in a new issue