2018-08-12 17:02:49 +02:00
|
|
|
let expect = require("chai").expect;
|
|
|
|
let freesewing = require("../dist/index.js");
|
2018-08-12 13:32:53 +02:00
|
|
|
|
|
|
|
it("Should create a snippet", () => {
|
2018-08-12 17:02:49 +02:00
|
|
|
let snip1 = new freesewing.Snippet(
|
2018-08-12 13:32:53 +02:00
|
|
|
"test",
|
|
|
|
new freesewing.Point(12, 34),
|
|
|
|
"this is an example"
|
|
|
|
);
|
|
|
|
expect(snip1.def).to.equal("test");
|
|
|
|
expect(snip1.anchor.x).to.equal(12);
|
|
|
|
expect(snip1.anchor.y).to.equal(34);
|
|
|
|
expect(snip1.description).to.equal("this is an example");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should default to empty description", () => {
|
2018-08-12 17:02:49 +02:00
|
|
|
let snip2 = new freesewing.Snippet("test", new freesewing.Point(12, 34));
|
2018-08-12 13:32:53 +02:00
|
|
|
expect(snip2.description).to.equal("");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should clone a snippet", () => {
|
2018-08-12 17:02:49 +02:00
|
|
|
let snip3 = new freesewing.Snippet(
|
2018-08-12 13:32:53 +02:00
|
|
|
"boo",
|
|
|
|
new freesewing.Point(56, 78),
|
|
|
|
"clone me"
|
|
|
|
);
|
|
|
|
expect(snip3.clone().def).to.equal("boo");
|
|
|
|
expect(snip3.clone().anchor.x).to.equal(56);
|
|
|
|
expect(snip3.clone().anchor.y).to.equal(78);
|
|
|
|
expect(snip3.clone().description).to.equal("clone me");
|
|
|
|
});
|