1
0
Fork 0

fix(plugin-annotations): Don't load core plugins in tests

This commit is contained in:
joostdecock 2023-09-08 10:50:03 +02:00
parent 6a7cc334ba
commit 31e7b50ba1
14 changed files with 96 additions and 114 deletions

View file

@ -23,7 +23,7 @@ describe('Banner Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
// Note that this macro does not add text to the path, but clones
@ -56,7 +56,7 @@ describe('Banner Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_banner_banner_banner
@ -83,7 +83,7 @@ describe('Banner Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_banner_banner_banner

View file

@ -19,7 +19,7 @@ describe('Bartack plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_bartack_bartack_stitches
@ -54,7 +54,7 @@ describe('Bartack plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_bartackalong_bartack_stitches
@ -91,7 +91,7 @@ describe('Bartack plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_bartackalong_bartack_stitches
@ -128,7 +128,7 @@ describe('Bartack plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_bartackfractionalong_bartack_stitches
@ -163,7 +163,7 @@ describe('Bartack plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_bartack_bartack_stitches
@ -198,7 +198,7 @@ describe('Bartack plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_bartack_bartack_stitches
@ -233,7 +233,7 @@ describe('Bartack plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_bartack_bartack_stitches
@ -268,7 +268,7 @@ describe('Bartack plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_bartack_foo_stitches
@ -290,7 +290,7 @@ describe('Bartack plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const design = new Design({ parts: [part] }, true)
const design = new Design({ parts: [part], noCorePlugins: true })
const pattern = new design()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_bartack_foo_stitches

View file

@ -26,7 +26,7 @@ describe('Buttons Plugin Test', () => {
},
plugins: [annotationsPlugin],
}
const Pattern = new Design({ parts: [part] })
const Pattern = new Design({ parts: [part], noCorePlugins: true })
const svg = new Pattern().draft().render()
expect(svg).to.contain('<use x="10" y="20" xlink:href="#button"')
})
@ -42,7 +42,7 @@ describe('Buttons Plugin Test', () => {
},
plugins: [annotationsPlugin],
}
const Pattern = new Design({ parts: [part] })
const Pattern = new Design({ parts: [part], noCorePlugins: true })
const svg = new Pattern().draft().render()
expect(svg).to.contain('<use x="10" y="20" xlink:href="#buttonhole"')
})
@ -58,7 +58,7 @@ describe('Buttons Plugin Test', () => {
},
plugins: [annotationsPlugin],
}
const Pattern = new Design({ parts: [part] })
const Pattern = new Design({ parts: [part], noCorePlugins: true })
const svg = new Pattern().draft().render()
expect(svg).to.contain('<use x="10" y="20" xlink:href="#buttonhole-start"')
})
@ -74,7 +74,7 @@ describe('Buttons Plugin Test', () => {
},
plugins: [annotationsPlugin],
}
const Pattern = new Design({ parts: [part] })
const Pattern = new Design({ parts: [part], noCorePlugins: true })
const svg = new Pattern().draft().render()
expect(svg).to.contain('<use x="10" y="20" xlink:href="#buttonhole-end"')
})
@ -90,7 +90,7 @@ describe('Buttons Plugin Test', () => {
},
plugins: [annotationsPlugin],
}
const Pattern = new Design({ parts: [part] })
const Pattern = new Design({ parts: [part], noCorePlugins: true })
const svg = new Pattern().draft().render()
expect(svg).to.contain('<use x="10" y="20" xlink:href="#snap-stud"')
})
@ -106,7 +106,7 @@ describe('Buttons Plugin Test', () => {
},
plugins: [annotationsPlugin],
}
const Pattern = new Design({ parts: [part] })
const Pattern = new Design({ parts: [part], noCorePlugins: true })
const svg = new Pattern().draft().render()
expect(svg).to.contain('<use x="10" y="20" xlink:href="#snap-socket"')
})

View file

@ -21,7 +21,7 @@ describe('Crossbox Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ plugins: [annotationsPlugin], parts: [part] }, true)
const Test = new Design({ plugins: [annotationsPlugin], parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
let c = pattern.parts[0].test.paths.__macro_crossbox_crossbox_box
@ -87,7 +87,7 @@ describe('Crossbox Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ plugins: [annotationsPlugin], parts: [part] }, true)
const Test = new Design({ plugins: [annotationsPlugin], parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(

View file

@ -16,7 +16,7 @@ describe('Cutlist Plugin Tests', () => {
},
plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(methods.addCut).to.be.a('function')
@ -36,7 +36,7 @@ describe('Cutlist Plugin Tests', () => {
},
plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(pattern.setStores[0].cutlist.example_part.materials.fabric).to.have.lengthOf(1)
@ -58,7 +58,7 @@ describe('Cutlist Plugin Tests', () => {
},
plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(pattern.setStores[0].cutlist.example_part.materials.lining).to.have.lengthOf(1)
@ -82,7 +82,7 @@ describe('Cutlist Plugin Tests', () => {
},
plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(pattern.setStores[0].cutlist.example_part.materials.lining).to.be.undefined
@ -100,7 +100,7 @@ describe('Cutlist Plugin Tests', () => {
},
plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(pattern.setStores[0].cutlist.example_part.materials.lining).to.be.undefined
@ -119,7 +119,7 @@ describe('Cutlist Plugin Tests', () => {
},
plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(pattern.setStores[0].cutlist.example_part.materials).to.be.undefined
@ -135,7 +135,7 @@ describe('Cutlist Plugin Tests', () => {
},
plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(pattern.setStores[0].cutlist.example_part.grain).to.equal(45)
@ -152,7 +152,7 @@ describe('Cutlist Plugin Tests', () => {
},
plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(pattern.setStores[0].cutlist.example_part.grain).to.be.undefined
@ -172,7 +172,7 @@ describe('Cutlist Plugin Tests', () => {
},
plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(pattern.setStores[0].cutlist.example_part.cutOnFold[0].x).to.equal(2)
@ -196,7 +196,7 @@ describe('Cutlist Plugin Tests', () => {
},
plugins: [annotationsPlugin],
}
const Test = new Design({ parts: [part] })
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(pattern.setStores[0].cutlist.example_part.cutOnFold).to.be.undefined

View file

@ -21,7 +21,7 @@ describe('Cutonfold Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ plugins: [annotationsPlugin], parts: [part] }, true)
const Test = new Design({ plugins: [annotationsPlugin], parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_cutonfold_cutonfold_line
@ -61,7 +61,7 @@ describe('Cutonfold Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ plugins: [annotationsPlugin], parts: [part] }, true)
const Test = new Design({ plugins: [annotationsPlugin], parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
expect(
@ -86,7 +86,7 @@ describe('Cutonfold Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ plugins: [annotationsPlugin], parts: [part] }, true)
const Test = new Design({ plugins: [annotationsPlugin], parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
let c = pattern.parts[0].test.paths.__macro_cutonfold_cutonfold_line
@ -126,7 +126,7 @@ describe('Cutonfold Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ plugins: [annotationsPlugin], parts: [part] }, true)
const Test = new Design({ plugins: [annotationsPlugin], parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
let c = pattern.parts[0].test.paths.__macro_cutonfold_cutonfold_line

View file

@ -23,7 +23,7 @@ describe('Dimension Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ parts: [part] }, true)
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
@ -83,7 +83,7 @@ describe('Dimension Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ parts: [part] }, true)
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
@ -143,7 +143,7 @@ describe('Dimension Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ parts: [part] }, true)
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
@ -204,7 +204,7 @@ describe('Dimension Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ parts: [part] }, true)
const Test = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()

View file

@ -21,7 +21,7 @@ describe('Grainline Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design({ parts: [part] }, true)
const Pattern = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Pattern()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_grainline_grainline_line

View file

@ -6,7 +6,7 @@ const expect = chai.expect
describe('Logo Plugin Tests', () => {
it('Should import style and defs', () => {
const Pattern = new Design()
const Pattern = new Design({ noCorePlugins: true })
const pattern = new Pattern().use(annotationsPlugin)
pattern.draft().render()
expect(pattern.svg.defs.get('logo')).to.not.equal(false)

View file

@ -11,7 +11,7 @@ const part = {
},
plugins: [annotationsPlugin],
}
const Pattern = new Design({ parts: [part] })
const Pattern = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Pattern()
pattern.draft().render()
@ -32,7 +32,7 @@ describe('Notches Plugin Test', () => {
},
plugins: [annotationsPlugin],
}
const Pattern = new Design({ parts: [part] })
const Pattern = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Pattern()
pattern.draft().render()
const c = pattern.svg

View file

@ -21,7 +21,7 @@ describe('Pleat Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ plugins: [annotationsPlugin], parts: [part] }, true)
const Test = new Design({ plugins: [annotationsPlugin], parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
let c = pattern.parts[0].test.paths.__macro_pleat_pleat_from
@ -68,7 +68,7 @@ describe('Pleat Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ plugins: [annotationsPlugin], parts: [part] }, true)
const Test = new Design({ plugins: [annotationsPlugin], parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
let c = pattern.parts[0].test.paths.__macro_pleat_pleat_from

View file

@ -19,7 +19,7 @@ describe('Scalebox Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design({ parts: [part] }, true)
const Pattern = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Pattern()
pattern.draft()
let p = pattern.parts[0].test.points
@ -80,7 +80,7 @@ describe('Scalebox Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design({ parts: [part] }, true)
const Pattern = new Design({ parts: [part], noCorePlugins: true })
const pattern = new Pattern()
pattern.draft()
const p = pattern.parts[0].test.points
@ -112,13 +112,11 @@ describe('Scalebox Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design(
{
const Pattern = new Design({
parts: [part],
data: { name: 'test', version: '1.2.3' },
},
true
)
noCorePlugins: true,
})
const pattern = new Pattern()
pattern.draft()
let p = pattern.parts[0].test.points.__macro_scalebox_scalebox_textLead.attributes
@ -149,13 +147,11 @@ describe('Scalebox Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design(
{
const Pattern = new Design({
parts: [part],
data: { name: 'test', version: '1.2.3' },
},
true
)
noCorePlugins: true,
})
const pattern = new Pattern()
pattern.draft()
let p = pattern.parts[0].test.points.__macro_scalebox_scalebox_textLead.attributes
@ -186,14 +182,12 @@ describe('Scalebox Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design(
{
const Pattern = new Design({
parts: [part],
plugins: [annotationsPlugin],
data: { name: 'test', version: '1.2.3' },
},
true
)
noCorePlugins: true,
})
const pattern = new Pattern({ scale: 0.5 })
pattern.draft()
let p = pattern.parts[0].test.paths.__macro_scalebox_scalebox_metric
@ -231,14 +225,12 @@ describe('Scalebox Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design(
{
const Pattern = new Design({
parts: [part],
plugins: [annotationsPlugin],
data: { name: 'test', version: '1.2.3' },
},
true
)
noCorePlugins: true,
})
const pattern = new Pattern({ scale: 0.5 })
pattern.draft()
let p = pattern.parts[0].test.paths.__macro_miniscale_miniscale_metric

View file

@ -21,7 +21,7 @@ describe('Sewtogether Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ plugins: [annotationsPlugin], parts: [part] }, true)
const Test = new Design({ plugins: [annotationsPlugin], parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
const c = pattern.parts[0].test.paths.__macro_sewtogether_sewtogether_curve
@ -60,7 +60,7 @@ describe('Sewtogether Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ plugins: [annotationsPlugin], parts: [part] }, true)
const Test = new Design({ plugins: [annotationsPlugin], parts: [part], noCorePlugins: true })
const pattern = new Test()
pattern.draft()
let c = pattern.parts[0].test.paths.__macro_sewtogether_sewtogether_hinge
@ -92,7 +92,7 @@ describe('Sewtogether Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Test = new Design({ plugins: [annotationsPlugin], parts: [part] }, true)
const Test = new Design({ plugins: [annotationsPlugin], parts: [part], noCorePlugins: true })
const pattern = new Test({ sa: 10 })
pattern.draft()
let c = pattern.parts[0].test.paths.__macro_sewtogether_sewtogether_hinge

View file

@ -21,13 +21,11 @@ describe('Title Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design(
{
const Pattern = new Design({
data: { name: 'testPattern', version: 99 },
parts: [part],
},
true
)
noCorePlugins: true,
})
const pattern = new Pattern()
pattern.draft().render()
let p = pattern.parts[0].test.points.__macro_title_title_nr
@ -68,13 +66,11 @@ describe('Title Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design(
{
const Pattern = new Design({
data: { name: 'testPattern', version: 99 },
parts: [part],
},
true
)
noCorePlugins: true,
})
const pattern = new Pattern()
pattern.draft().render()
let p = pattern.parts[0].test.points.__macro_title_title_nr
@ -103,13 +99,11 @@ describe('Title Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design(
{
const Pattern = new Design({
data: { name: 'testPattern', version: 99 },
parts: [part],
},
true
)
noCorePlugins: true,
})
const pattern = new Pattern()
pattern.draft().render()
let p = pattern.parts[0].test.points.__macro_title_foo_nr
@ -163,13 +157,11 @@ describe('Title Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design(
{
const Pattern = new Design({
data: { name: 'testPattern', version: 99 },
parts: [part],
},
true
)
noCorePlugins: true,
})
const pattern = new Pattern()
pattern.draft().render()
for (const align of ['left', 'center', 'right']) {
@ -201,13 +193,11 @@ describe('Title Plugin Tests', () => {
plugins: [annotationsPlugin],
}
// Note that we're not loading core plugins but the local plugin
const Pattern = new Design(
{
const Pattern = new Design({
data: { name: 'testPattern', version: 99 },
parts: [part],
},
true
)
noCorePlugins: true,
})
const pattern = new Pattern()
pattern.draft().render()
let p = pattern.parts[0].test.points