Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("generate a portal", () => {
assert.deepEqual(generatePortal(new Vec3(2,1,1),new Vec3(1,0,0),4,5),{
bottom:generateLine(new Vec3(3,1,1),new Vec3(1,0,0),2),
left:generateLine(new Vec3(2,2,1),new Vec3(0,1,0),3),
right:generateLine(new Vec3(5,2,1),new Vec3(0,1,0),3),
top:generateLine(new Vec3(3,5,1),new Vec3(1,0,0),2),
air:generateLine(new Vec3(3,2,1),new Vec3(0,1,0),3).concat(generateLine(new Vec3(4,2,1),new Vec3(0,1,0),3))
})
});
});
portalData.forEach(({name,bottomLeft,direction,width,height,additionalAir,additionalObsidian}) => {
const portal = generatePortal(bottomLeft, direction, width, height);
const {bottom,left,right,top}=portal;
describe("Doesn't detect detect " + name, () => {
let world;
before(async function () {
world=await makeWorldWithPortal(portal, additionalAir, additionalObsidian);
});
describe("doesn't detect portals",function(){
it("doesn't detect portals from bottom left",async function() {
const portals=await detectFrame(world,bottom[0],new Vec3(0,1,0));
assert.deepEqual(portals,[])
});
it("doesn't detect portals from top left",async function() {
const portals=await detectFrame(world,top[0],new Vec3(0,-1,0));
assert.deepEqual(portals,[])
});
direction:new Vec3(1,0,0),
width:10,
height:10,
additionalAir:[],
additionalObsidian:[]
});
portalData.push({
name:"simple portal frame x with borders",
bottomLeft:new Vec3(2,1,1),
direction:new Vec3(1,0,0),
width:4,
height:5,
additionalAir:[],
additionalObsidian:[new Vec3(2,1,1),new Vec3(5,1,1),new Vec3(2,6,1),new Vec3(5,6,1)]
});
const {bottom,left,right,top,air}=generatePortal(new Vec3(2,1,2),new Vec3(1,0,0),4,5);
portalData.push({
name:"2 portals",
bottomLeft:new Vec3(2,1,1),
direction:new Vec3(1,0,0),
width:4,
height:5,
additionalAir:air,
additionalObsidian:[].concat.apply([], [bottom, left, right,top])
});
portalData.push({
name:"huge simple portal frame z",
bottomLeft:new Vec3(2,1,1),
direction:new Vec3(0,0,1),