sparkles: Fixed merge conflict
This commit is contained in:
parent
c89f7c66a1
commit
88118b8899
7 changed files with 5773 additions and 1090 deletions
99
packages/plugin-debug/tests/debug.test.js
Normal file
99
packages/plugin-debug/tests/debug.test.js
Normal file
|
@ -0,0 +1,99 @@
|
|||
import freesewing from "freesewing";
|
||||
import { version } from "../package.json";
|
||||
let expect = require("chai").expect;
|
||||
let debugPlugin = require("../dist/index.js");
|
||||
|
||||
let output;
|
||||
let debug = debugPlugin.hooks.debug;
|
||||
|
||||
function next() {}
|
||||
|
||||
debugPlugin.log = function(d = "", e = "", b = "", u = "", g = "", gg = "") {
|
||||
output = { d, e, b, u, g, gg };
|
||||
};
|
||||
|
||||
it("Should set the plugin name:version attribute", () => {
|
||||
let pattern = new freesewing.Pattern().with(debugPlugin);
|
||||
pattern.render();
|
||||
expect(pattern.svg.attributes.get("freesewing:plugin-debug")).to.equal(
|
||||
version
|
||||
);
|
||||
});
|
||||
|
||||
it("Should log empty", () => {
|
||||
output = {};
|
||||
debug(next);
|
||||
expect(output.d).to.equal("%cdebug");
|
||||
expect(output.e).to.equal("color: Magenta;");
|
||||
expect(output.b).to.equal("");
|
||||
expect(output.u).to.equal("");
|
||||
expect(output.g).to.equal("");
|
||||
expect(output.gg).to.equal("");
|
||||
});
|
||||
|
||||
it("Should log default debug", () => {
|
||||
output = {};
|
||||
debug(next, "Debug message", "more info");
|
||||
expect(output.d).to.equal("%cdebug");
|
||||
expect(output.e).to.equal("color: Magenta;");
|
||||
expect(output.b).to.equal("Debug message");
|
||||
expect(output.u).to.equal("more info");
|
||||
expect(output.g).to.equal("");
|
||||
expect(output.gg).to.equal("");
|
||||
});
|
||||
|
||||
it("Should log styled debug for node", () => {
|
||||
output = {};
|
||||
debug(next, "debug", "label", "Debug message", "more info");
|
||||
expect(output.d).to.equal("%clabel");
|
||||
expect(output.e).to.equal("color: Magenta;");
|
||||
expect(output.b).to.equal("Debug message");
|
||||
expect(output.u).to.equal("more info");
|
||||
expect(output.g).to.equal("");
|
||||
expect(output.gg).to.equal("");
|
||||
});
|
||||
|
||||
it("Should log styled info for node", () => {
|
||||
output = {};
|
||||
debug(next, "info", "label", "Debug message", "more info");
|
||||
expect(output.d).to.equal("%clabel");
|
||||
expect(output.e).to.equal("color: RoyalBlue;");
|
||||
expect(output.b).to.equal("Debug message");
|
||||
expect(output.u).to.equal("more info");
|
||||
expect(output.g).to.equal("");
|
||||
expect(output.gg).to.equal("");
|
||||
});
|
||||
|
||||
it("Should log styled success for node", () => {
|
||||
output = {};
|
||||
debug(next, "success", "label", "Debug message", "more info");
|
||||
expect(output.d).to.equal("%clabel");
|
||||
expect(output.e).to.equal("color: OliveDrab;");
|
||||
expect(output.b).to.equal("Debug message");
|
||||
expect(output.u).to.equal("more info");
|
||||
expect(output.g).to.equal("");
|
||||
expect(output.gg).to.equal("");
|
||||
expect(output.g).to.equal("");
|
||||
});
|
||||
|
||||
it("Should log styled warning for node", () => {
|
||||
output = {};
|
||||
debug(next, "warning", "label", "Debug message", "more info");
|
||||
expect(output.d).to.equal("%clabel");
|
||||
expect(output.e).to.equal("color: Tomato;");
|
||||
expect(output.b).to.equal("Debug message");
|
||||
expect(output.u).to.equal("more info");
|
||||
expect(output.g).to.equal("");
|
||||
expect(output.gg).to.equal("");
|
||||
});
|
||||
|
||||
it("Should log styled error for node", () => {
|
||||
output = {};
|
||||
debug(next, "error", "label", "Debug message", "more info");
|
||||
expect(output.d).to.equal("%clabel");
|
||||
expect(output.e).to.equal("color: Red;");
|
||||
expect(output.b).to.equal("Debug message");
|
||||
expect(output.u).to.equal("more info");
|
||||
expect(output.g).to.equal("");
|
||||
expect(output.gg).to.equal("");
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue