1
0
Fork 0

chore(plugin-bust): Ported to v3

This commit is contained in:
Joost De Cock 2022-08-28 12:05:47 +02:00
parent 990f899450
commit 55f3efe883
5 changed files with 24 additions and 19 deletions

View file

@ -1,6 +1,6 @@
import chai from 'chai'
import freesewing from '@freesewing/core'
import plugin from '../dist/index.mjs'
import { Design, Pattern } from '@freesewing/core'
import { plugin } from './dist/index.mjs'
const expect = chai.expect
@ -9,7 +9,7 @@ const measurements = {
highBust: 90,
}
const pattern = new freesewing.Pattern({ measurements } ).use(plugin)
const pattern = new Pattern({ measurements } ).use(plugin)
pattern.apply({measurements}).draft().render()
describe('Bust plugin Tests', () => {
@ -19,10 +19,12 @@ describe('Bust plugin Tests', () => {
})
it('Should copy measurement from chest to bust and from highBust to chest', function () {
let config = {measurements:{}}
const testPattern = new freesewing.Design(config,plugin)
let pattern = new testPattern()
let userMeasurements = {chest: 50, highBust: 60}
const testPattern = new Design({
measurements: {},
plugins: [ plugin ]
})
const pattern = new testPattern()
const userMeasurements = {chest: 50, highBust: 60}
pattern.settings.measurements = userMeasurements;
pattern.draft()
expect(pattern.settings.measurements.bust).to.equal(50)
@ -31,7 +33,7 @@ describe('Bust plugin Tests', () => {
it('Should not overwrite existing bust measurements', function () {
let config = {measurements:{}}
const testPattern = new freesewing.Design(config,plugin)
const testPattern = new Design(config,plugin)
let pattern = new testPattern()
let userMeasurements = {chest: 50, highBust: 60, bust: 55}
pattern.settings.measurements = userMeasurements