Expand test coverage (#77)

* ignore line endings in cli tests
* ignore line endings in integration tests
* expand code coverage for `choc` footprint
* expand code coverage for `chocmini` footprint
* expand code coverage for `mx` footprint
* expand code coverage for `pad` footprint
* expand code coverage for rest of footprints
* expand code coverage for `anchor.js`
* expand code coverage for `units.js`
* expand code coverage for `points.js`
* expand code coverage for `filter.js`
* expand code coverage for `outlines.js`
* expand code coverage for `pcbs.js`
* expand code coverage for `ergogen.js`
* expand code coverage for `kle.js`
* more code coverage for `outlines.js`
* expand code coverage for `cases.js`
This commit is contained in:
Luke Kershaw 2023-01-23 09:02:08 +00:00 committed by GitHub
parent 3746900490
commit e0eb43566f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 2842 additions and 37 deletions

View file

@ -56,6 +56,21 @@ describe('Anchor', function() {
}, 'name', points)(),
[5, 5, -45, {}]
)
// empty parts
check(
parse({
aggregate: {
}
}, 'name', points)(),
[0, 0, 0, {}]
)
// can't have aggregate and ref together
parse({
aggregate: {
parts: ['o', 'ten']
},
ref : 'ten'
}, 'name', points).should.throw()
})
it('shift', function() {

View file

@ -4,6 +4,12 @@ const Point = require('../../src/point')
describe('Filter', function() {
it('empty', function() {
filter(undefined, '').should.deep.equal([new Point()])
filter(true, '').should.deep.equal([])
filter(false, '').should.deep.equal([])
})
const points = {
one: new Point(0, 1, 0, {name: 'one', tags: ['odd']}),
two: new Point(0, 2, 0, {name: 'two', tags: ['even', 'prime']}),
@ -18,8 +24,15 @@ describe('Filter', function() {
// true shouldn't filter anything, while false should filter everything
filter(true, '', points).should.deep.equal(Object.values(points))
filter(false, '', points).should.deep.equal([])
// points should only be returned on their respective halves
filter(true, '', points, undefined, 'source').should.deep.equal(Object.values(points))
filter(true, '', points, undefined, 'clone').should.deep.equal([])
filter(true, '', points, undefined, 'both').should.deep.equal(Object.values(points))
// objects just propagate to anchor (and then wrap in array for consistency)
filter({}, '', points).should.deep.equal([anchor({}, '', points)()])
filter({}, '', points, undefined, 'source').should.deep.equal([anchor({}, '', points)()])
filter({}, '', points, undefined, 'clone').should.deep.equal([anchor({}, '', points)()])
filter({}, '', points, undefined, 'both').should.deep.equal([anchor({}, '', points)(), anchor({}, '', points)()])
// simple name string
names(filter('one', '', points)).should.deep.equal(['one'])
// simple name regex
@ -42,4 +55,4 @@ describe('Filter', function() {
filter.bind(this, 28, '', points).should.throw('Unexpected type')
})
})
})

View file

@ -10,7 +10,8 @@ const load = name => yaml.safeLoad(fs.readFileSync(
).toString())
const minimal = load('minimal.yaml')
const big = load('big.yaml')
const kle = load('atreus_kle.json')
const minimal_kle = load('minimal_kle.json')
const atreus_kle = load('atreus_kle.json')
describe('Interface', function() {
@ -49,7 +50,8 @@ describe('Interface', function() {
//:
return 'not an object';
`, true, logger).should.be.rejectedWith('not valid'),
ergogen.process(kle, true, logger).should.be.rejectedWith('KLE'),
ergogen.process(minimal_kle, true, logger).should.be.rejectedWith('KLE'),
ergogen.process(atreus_kle, true, logger).should.be.rejectedWith('KLE'),
ergogen.process('not an object', true, logger).should.be.rejectedWith('object'),
ergogen.process({}, true, logger).should.be.rejectedWith('empty'),
ergogen.process({not_points: {}}, true, () => {}).should.be.rejectedWith('points clause'),

View file

@ -5,12 +5,19 @@ describe('Units', function() {
it('defaults', function() {
// check that an empty config has the default units (and nothing more)
const def = u.parse({})
Object.keys(def).filter(public).length.should.equal(4)
def.U.should.equal(19.05)
def.u.should.equal(19)
def.cx.should.equal(18)
def.cy.should.equal(17)
const def1 = u.parse({})
Object.keys(def1).filter(public).length.should.equal(4)
def1.U.should.equal(19.05)
def1.u.should.equal(19)
def1.cx.should.equal(18)
def1.cy.should.equal(17)
// check that an empty config has the default units (and nothing more)
const def2 = u.parse()
Object.keys(def2).filter(public).length.should.equal(4)
def2.U.should.equal(19.05)
def2.u.should.equal(19)
def2.cx.should.equal(18)
def2.cy.should.equal(17)
})
it('units', function() {
@ -47,4 +54,4 @@ describe('Units', function() {
res.a.should.equal(20.05)
})
})
})