Outsource kicad outline conversion to pcb templates

This commit is contained in:
Bán Dénes 2024-03-29 20:02:17 +01:00
parent 6079aaf332
commit de7441d632
6 changed files with 57 additions and 46 deletions

Binary file not shown.

View file

@ -1,3 +1,6 @@
module.exports = params => {
return `Custom template override. The secret is ${params.custom.secret}.`
module.exports = {
convert_outline: () => {},
body: params => {
return `Custom template override. The secret is ${params.custom.secret}.`
}
}

View file

@ -140,7 +140,10 @@ exports.inject = (ergogen) => {
}
})
ergogen.inject('template', 'template_test', params => {
return `Custom template override. The secret is ${params.custom.secret}.`
ergogen.inject('template', 'template_test', {
convert_outline: () => {},
body: params => {
return `Custom template override. The secret is ${params.custom.secret}.`
}
})
}

View file

@ -1,15 +1,15 @@
const m = require('makerjs')
const pcb_lib = require('../../src/pcbs')
const kicad5 = require('../../src/templates/kicad5')
const ergogen = require('../../src/ergogen')
describe('Internals', function() {
it('makerjs2kicad', function() {
it('pcb outline conversion', function() {
// warn on unknown path type
sinon.stub(m.model, 'walk').callsFake(function(model, config) {
config.onPath({pathContext: {type: 'nonexistent'}})
})
pcb_lib._makerjs2kicad.bind(this).should.throw("Can't convert path type")
kicad5.convert_outline.bind(this).should.throw("Can't convert path type")
})
it('injection', function() {