✅ Tests for utils
This commit is contained in:
parent
6b1c3fbaaf
commit
9d486fd617
5 changed files with 138 additions and 20 deletions
31
tests/snippet.test.js
Normal file
31
tests/snippet.test.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
var expect = require("chai").expect;
|
||||
var freesewing = require("../dist/index.js");
|
||||
|
||||
it("Should create a snippet", () => {
|
||||
var snip1 = new freesewing.Snippet(
|
||||
"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", () => {
|
||||
var snip2 = new freesewing.Snippet("test", new freesewing.Point(12, 34));
|
||||
expect(snip2.description).to.equal("");
|
||||
});
|
||||
|
||||
it("Should clone a snippet", () => {
|
||||
var snip3 = new freesewing.Snippet(
|
||||
"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");
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue