This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/fablabchemnitz/papercraft/openjscad/node_modules/@jscad/scad-api/src/clone.test.js

28 lines
947 B
JavaScript

const test = require('ava')
const { cube } = require('./primitives3d')
const { clone } = require('./clone')
test('clone', t => {
const obs = clone(cube())
const expFirstPoly = {
vertices: [ { pos: { _x: 0, _y: 0, _z: 0 } },
{ pos: { _x: 0, _y: 0, _z: 1 } },
{ pos: { _x: 0, _y: 1, _z: 1 } },
{ pos: { _x: 0, _y: 1, _z: 0 } } ],
shared: { color: null },
plane: { normal: { _x: -1, _y: -0, _z: -0 }, w: -0 }
}
const expLastPoly = { vertices: [ { pos: { _x: 0, _y: 0, _z: 1 } },
{ pos: { _x: 1, _y: 0, _z: 1 } },
{ pos: { _x: 1, _y: 1, _z: 1 } },
{ pos: { _x: 0, _y: 1, _z: 1 } } ],
shared: { color: null },
plane: { normal: { _x: 0, _y: -0, _z: 1 }, w: 1 } }
t.deepEqual(obs.properties.cube.center, {_x: 0.5, _y: 0.5, _z: 0.5})
t.deepEqual(obs.polygons.length, 6)
t.deepEqual(obs.polygons[0], expFirstPoly)
t.deepEqual(obs.polygons[obs.polygons.length - 1], expLastPoly)
})