chore(core): log.warning is now log.warn
This commit is contained in:
parent
e60362935c
commit
5c00551bca
14 changed files with 134 additions and 143 deletions
|
@ -175,7 +175,7 @@ Part.prototype.shorthand = function () {
|
||||||
shorthand.measurements = new Proxy(this.context.settings.measurements, {
|
shorthand.measurements = new Proxy(this.context.settings.measurements, {
|
||||||
get: function (measurements, name) {
|
get: function (measurements, name) {
|
||||||
if (typeof measurements[name] === 'undefined')
|
if (typeof measurements[name] === 'undefined')
|
||||||
self.context.store.log.warning(
|
self.context.store.log.warn(
|
||||||
`${self.name} tried to access \`measurements.${name}\` but it is \`undefined\``
|
`${self.name} tried to access \`measurements.${name}\` but it is \`undefined\``
|
||||||
)
|
)
|
||||||
return Reflect.get(...arguments)
|
return Reflect.get(...arguments)
|
||||||
|
@ -185,9 +185,7 @@ Part.prototype.shorthand = function () {
|
||||||
shorthand.options = new Proxy(this.context.settings.options, {
|
shorthand.options = new Proxy(this.context.settings.options, {
|
||||||
get: function (options, name) {
|
get: function (options, name) {
|
||||||
if (typeof options[name] === 'undefined')
|
if (typeof options[name] === 'undefined')
|
||||||
self.context.store.log.warning(
|
self.context.store.log.warn(`Tried to access \`options.${name}\` but it is \`undefined\``)
|
||||||
`Tried to access \`options.${name}\` but it is \`undefined\``
|
|
||||||
)
|
|
||||||
return Reflect.get(...arguments)
|
return Reflect.get(...arguments)
|
||||||
},
|
},
|
||||||
set: (options, name, value) => (self.context.settings.options[name] = value),
|
set: (options, name, value) => (self.context.settings.options[name] = value),
|
||||||
|
@ -195,7 +193,7 @@ Part.prototype.shorthand = function () {
|
||||||
shorthand.absoluteOptions = new Proxy(this.context.settings.absoluteOptions, {
|
shorthand.absoluteOptions = new Proxy(this.context.settings.absoluteOptions, {
|
||||||
get: function (absoluteOptions, name) {
|
get: function (absoluteOptions, name) {
|
||||||
if (typeof absoluteOptions[name] === 'undefined')
|
if (typeof absoluteOptions[name] === 'undefined')
|
||||||
self.context.store.log.warning(
|
self.context.store.log.warn(
|
||||||
`Tried to access \`absoluteOptions.${name}\` but it is \`undefined\``
|
`Tried to access \`absoluteOptions.${name}\` but it is \`undefined\``
|
||||||
)
|
)
|
||||||
return Reflect.get(...arguments)
|
return Reflect.get(...arguments)
|
||||||
|
@ -361,7 +359,7 @@ Part.prototype.__macroClosure = function (props) {
|
||||||
const macro = utils.__macroName(key)
|
const macro = utils.__macroName(key)
|
||||||
if (typeof self[macro] === 'function') self[macro](args, props)
|
if (typeof self[macro] === 'function') self[macro](args, props)
|
||||||
else if ('context' in self)
|
else if ('context' in self)
|
||||||
self.context.store.log.warning('Unknown macro `' + key + '` used in ' + self.name)
|
self.context.store.log.warn('Unknown macro `' + key + '` used in ' + self.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
return method
|
return method
|
||||||
|
@ -377,7 +375,7 @@ Part.prototype.__unitsClosure = function () {
|
||||||
const self = this
|
const self = this
|
||||||
const method = function (value) {
|
const method = function (value) {
|
||||||
if (typeof value !== 'number')
|
if (typeof value !== 'number')
|
||||||
self.context.store.log.warning(
|
self.context.store.log.warn(
|
||||||
`Calling \`units(value)\` but \`value\` is not a number (\`${typeof value}\`)`
|
`Calling \`units(value)\` but \`value\` is not a number (\`${typeof value}\`)`
|
||||||
)
|
)
|
||||||
return utils.units(value, self.context.settings.units)
|
return utils.units(value, self.context.settings.units)
|
||||||
|
|
|
@ -47,9 +47,9 @@ export function Path() {
|
||||||
*/
|
*/
|
||||||
Path.prototype._curve = function (cp2, to) {
|
Path.prototype._curve = function (cp2, to) {
|
||||||
if (to instanceof Point !== true)
|
if (to instanceof Point !== true)
|
||||||
this.log.warning('Called `Path._curve(cp2, to)` but `to` is not a `Point` object')
|
this.log.warn('Called `Path._curve(cp2, to)` but `to` is not a `Point` object')
|
||||||
if (cp2 instanceof Point !== true)
|
if (cp2 instanceof Point !== true)
|
||||||
this.log.warning('Called `Path._curve(cp2, to)` but `cp2` is not a `Point` object')
|
this.log.warn('Called `Path._curve(cp2, to)` but `cp2` is not a `Point` object')
|
||||||
let cp1 = this.ops.slice(-1).pop().to
|
let cp1 = this.ops.slice(-1).pop().to
|
||||||
this.ops.push({ type: 'curve', cp1, cp2, to })
|
this.ops.push({ type: 'curve', cp1, cp2, to })
|
||||||
|
|
||||||
|
@ -150,11 +150,11 @@ Path.prototype.asRenderProps = function () {
|
||||||
*/
|
*/
|
||||||
Path.prototype.attr = function (name, value, overwrite = false) {
|
Path.prototype.attr = function (name, value, overwrite = false) {
|
||||||
if (!name)
|
if (!name)
|
||||||
this.log.warning(
|
this.log.warn(
|
||||||
'Called `Path.attr(name, value, overwrite=false)` but `name` is undefined or false'
|
'Called `Path.attr(name, value, overwrite=false)` but `name` is undefined or false'
|
||||||
)
|
)
|
||||||
if (typeof value === 'undefined')
|
if (typeof value === 'undefined')
|
||||||
this.log.warning('Called `Path.attr(name, value, overwrite=false)` but `value` is undefined')
|
this.log.warn('Called `Path.attr(name, value, overwrite=false)` but `value` is undefined')
|
||||||
if (overwrite)
|
if (overwrite)
|
||||||
this.log.debug(
|
this.log.debug(
|
||||||
`Overwriting \`Path.attribute.${name}\` with ${value} (was: ${this.attributes.get(name)})`
|
`Overwriting \`Path.attribute.${name}\` with ${value} (was: ${this.attributes.get(name)})`
|
||||||
|
@ -276,11 +276,11 @@ Path.prototype.close = function () {
|
||||||
*/
|
*/
|
||||||
Path.prototype.curve = function (cp1, cp2, to) {
|
Path.prototype.curve = function (cp1, cp2, to) {
|
||||||
if (to instanceof Point !== true)
|
if (to instanceof Point !== true)
|
||||||
this.log.warning('Called `Path.curve(cp1, cp2, to)` but `to` is not a `Point` object')
|
this.log.warn('Called `Path.curve(cp1, cp2, to)` but `to` is not a `Point` object')
|
||||||
if (cp1 instanceof Point !== true)
|
if (cp1 instanceof Point !== true)
|
||||||
this.log.warning('Called `Path.curve(cp1, cp2, to)` but `cp1` is not a `Point` object')
|
this.log.warn('Called `Path.curve(cp1, cp2, to)` but `cp1` is not a `Point` object')
|
||||||
if (cp2 instanceof Point !== true)
|
if (cp2 instanceof Point !== true)
|
||||||
this.log.warning('Called `Path.curve(cp1, cp2, to)` but `cp2` is not a `Point` object')
|
this.log.warn('Called `Path.curve(cp1, cp2, to)` but `cp2` is not a `Point` object')
|
||||||
this.ops.push({ type: 'curve', cp1, cp2, to })
|
this.ops.push({ type: 'curve', cp1, cp2, to })
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
@ -295,9 +295,9 @@ Path.prototype.curve = function (cp1, cp2, to) {
|
||||||
*/
|
*/
|
||||||
Path.prototype.curve_ = function (cp1, to) {
|
Path.prototype.curve_ = function (cp1, to) {
|
||||||
if (to instanceof Point !== true)
|
if (to instanceof Point !== true)
|
||||||
this.log.warning('Called `Path.curve_(cp1, to)` but `to` is not a `Point` object')
|
this.log.warn('Called `Path.curve_(cp1, to)` but `to` is not a `Point` object')
|
||||||
if (cp1 instanceof Point !== true)
|
if (cp1 instanceof Point !== true)
|
||||||
this.log.warning('Called `Path.curve_(cp1, to)` but `cp1` is not a `Point` object')
|
this.log.warn('Called `Path.curve_(cp1, to)` but `cp1` is not a `Point` object')
|
||||||
let cp2 = to.copy()
|
let cp2 = to.copy()
|
||||||
this.ops.push({ type: 'curve', cp1, cp2, to })
|
this.ops.push({ type: 'curve', cp1, cp2, to })
|
||||||
|
|
||||||
|
@ -405,10 +405,9 @@ Path.prototype.hide = function () {
|
||||||
* @return {object} this - The Path instance
|
* @return {object} this - The Path instance
|
||||||
*/
|
*/
|
||||||
Path.prototype.insop = function (noopId, path) {
|
Path.prototype.insop = function (noopId, path) {
|
||||||
if (!noopId)
|
if (!noopId) this.log.warn('Called `Path.insop(noopId, path)` but `noopId` is undefined or false')
|
||||||
this.log.warning('Called `Path.insop(noopId, path)` but `noopId` is undefined or false')
|
|
||||||
if (path instanceof Path !== true)
|
if (path instanceof Path !== true)
|
||||||
this.log.warning('Called `Path.insop(noopId, path) but `path` is not a `Path` object')
|
this.log.warn('Called `Path.insop(noopId, path) but `path` is not a `Path` object')
|
||||||
let newPath = this.clone()
|
let newPath = this.clone()
|
||||||
for (let i in newPath.ops) {
|
for (let i in newPath.ops) {
|
||||||
if (newPath.ops[i].type === 'noop' && newPath.ops[i].id === noopId) {
|
if (newPath.ops[i].type === 'noop' && newPath.ops[i].id === noopId) {
|
||||||
|
@ -561,7 +560,7 @@ Path.prototype.length = function () {
|
||||||
*/
|
*/
|
||||||
Path.prototype.line = function (to) {
|
Path.prototype.line = function (to) {
|
||||||
if (to instanceof Point !== true)
|
if (to instanceof Point !== true)
|
||||||
this.log.warning('Called `Path.line(to)` but `to` is not a `Point` object')
|
this.log.warn('Called `Path.line(to)` but `to` is not a `Point` object')
|
||||||
this.ops.push({ type: 'line', to })
|
this.ops.push({ type: 'line', to })
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
@ -575,7 +574,7 @@ Path.prototype.line = function (to) {
|
||||||
*/
|
*/
|
||||||
Path.prototype.move = function (to) {
|
Path.prototype.move = function (to) {
|
||||||
if (to instanceof Point !== true)
|
if (to instanceof Point !== true)
|
||||||
this.log.warning('Called `Path.move(to)` but `to` is not a `Point` object')
|
this.log.warn('Called `Path.move(to)` but `to` is not a `Point` object')
|
||||||
this.ops.push({ type: 'move', to })
|
this.ops.push({ type: 'move', to })
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
@ -761,9 +760,9 @@ Path.prototype.shiftFractionAlong = function (fraction, stepsPerMm = 10) {
|
||||||
*/
|
*/
|
||||||
Path.prototype.smurve = function (cp2, to) {
|
Path.prototype.smurve = function (cp2, to) {
|
||||||
if (to instanceof Point !== true)
|
if (to instanceof Point !== true)
|
||||||
this.log.warning('Called `Path.smurve(cp2, to)` but `to` is not a `Point` object')
|
this.log.warn('Called `Path.smurve(cp2, to)` but `to` is not a `Point` object')
|
||||||
if (cp2 instanceof Point !== true)
|
if (cp2 instanceof Point !== true)
|
||||||
this.log.warning('Called `Path.smurve(cp2, to)` but `cp2` is not a `Point` object')
|
this.log.warn('Called `Path.smurve(cp2, to)` but `cp2` is not a `Point` object')
|
||||||
// Retrieve cp1 from previous operation
|
// Retrieve cp1 from previous operation
|
||||||
const prevOp = this.ops.slice(-1).pop()
|
const prevOp = this.ops.slice(-1).pop()
|
||||||
const cp1 = prevOp.cp2.rotate(180, prevOp.to)
|
const cp1 = prevOp.cp2.rotate(180, prevOp.to)
|
||||||
|
@ -779,7 +778,7 @@ Path.prototype.smurve = function (cp2, to) {
|
||||||
*/
|
*/
|
||||||
Path.prototype.smurve_ = function (to) {
|
Path.prototype.smurve_ = function (to) {
|
||||||
if (to instanceof Point !== true)
|
if (to instanceof Point !== true)
|
||||||
this.log.warning('Called `Path.smurve_(to)` but `to` is not a `Point` object')
|
this.log.warn('Called `Path.smurve_(to)` but `to` is not a `Point` object')
|
||||||
// Retrieve cp1 from previous operation
|
// Retrieve cp1 from previous operation
|
||||||
const prevOp = this.ops.slice(-1).pop()
|
const prevOp = this.ops.slice(-1).pop()
|
||||||
const cp1 = prevOp.cp2.rotate(180, prevOp.to)
|
const cp1 = prevOp.cp2.rotate(180, prevOp.to)
|
||||||
|
@ -898,10 +897,8 @@ Path.prototype.start = function () {
|
||||||
* @return {Path} this - This Path instance
|
* @return {Path} this - This Path instance
|
||||||
*/
|
*/
|
||||||
Path.prototype.translate = function (x, y) {
|
Path.prototype.translate = function (x, y) {
|
||||||
if (typeof x !== 'number')
|
if (typeof x !== 'number') this.log.warn('Called `Path.translate(x, y)` but `x` is not a number')
|
||||||
this.log.warning('Called `Path.translate(x, y)` but `x` is not a number')
|
if (typeof y !== 'number') this.log.warn('Called `Path.translate(x, y)` but `y` is not a number')
|
||||||
if (typeof y !== 'number')
|
|
||||||
this.log.warning('Called `Path.translate(x, y)` but `y` is not a number')
|
|
||||||
let clone = this.clone()
|
let clone = this.clone()
|
||||||
for (let op of clone.ops) {
|
for (let op of clone.ops) {
|
||||||
if (op.type !== 'close') {
|
if (op.type !== 'close') {
|
||||||
|
@ -1126,11 +1123,11 @@ export function pathsProxy(paths, log) {
|
||||||
set: (paths, name, value) => {
|
set: (paths, name, value) => {
|
||||||
// Constructor checks
|
// Constructor checks
|
||||||
if (value instanceof Path !== true)
|
if (value instanceof Path !== true)
|
||||||
log.warning(`\`paths.${name}\` was set with a value that is not a \`Path\` object`)
|
log.warn(`\`paths.${name}\` was set with a value that is not a \`Path\` object`)
|
||||||
try {
|
try {
|
||||||
value.name = name
|
value.name = name
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.warning(`Could not set \`name\` property on \`paths.${name}\``)
|
log.warn(`Could not set \`name\` property on \`paths.${name}\``)
|
||||||
}
|
}
|
||||||
return (paths[name] = value)
|
return (paths[name] = value)
|
||||||
},
|
},
|
||||||
|
|
|
@ -142,7 +142,7 @@ PatternPlugins.prototype.__loadPluginMacros = function (plugin) {
|
||||||
PatternPlugins.prototype.__loadPluginStoreMethods = function (plugin) {
|
PatternPlugins.prototype.__loadPluginStoreMethods = function (plugin) {
|
||||||
if (Array.isArray(plugin.store)) {
|
if (Array.isArray(plugin.store)) {
|
||||||
for (const method of plugin.store) this.__storeMethods.add(method)
|
for (const method of plugin.store) this.__storeMethods.add(method)
|
||||||
} else this.store.log.warning(`Plugin store methods should be an Array`)
|
} else this.store.log.warn(`Plugin store methods should be an Array`)
|
||||||
|
|
||||||
// console.log('store', plugin, this.__storeMethods)
|
// console.log('store', plugin, this.__storeMethods)
|
||||||
return this
|
return this
|
||||||
|
|
|
@ -89,7 +89,7 @@ PatternRenderer.prototype.__pack = function () {
|
||||||
const { settings, setStores, activeSet } = this.pattern
|
const { settings, setStores, activeSet } = this.pattern
|
||||||
for (const set in settings) {
|
for (const set in settings) {
|
||||||
if (setStores[set].logs.error.length > 0) {
|
if (setStores[set].logs.error.length > 0) {
|
||||||
setStores[set].log.warning(`One or more errors occured. Not packing pattern parts`)
|
setStores[set].log.warn(`One or more errors occured. Not packing pattern parts`)
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ Point.prototype.flipX = function (that = false) {
|
||||||
this.__check()
|
this.__check()
|
||||||
if (that) {
|
if (that) {
|
||||||
if (that instanceof Point !== true)
|
if (that instanceof Point !== true)
|
||||||
this.log.warning('Called `Point.rotate(deg,that)` but `that` is not a `Point` object')
|
this.log.warn('Called `Point.rotate(deg,that)` but `that` is not a `Point` object')
|
||||||
that.__check()
|
that.__check()
|
||||||
}
|
}
|
||||||
if (that === false || that.x === 0) return new Point(this.x * -1, this.y).__withLog(this.log)
|
if (that === false || that.x === 0) return new Point(this.x * -1, this.y).__withLog(this.log)
|
||||||
|
@ -161,7 +161,7 @@ Point.prototype.flipY = function (that = false) {
|
||||||
this.__check()
|
this.__check()
|
||||||
if (that) {
|
if (that) {
|
||||||
if (that instanceof Point !== true)
|
if (that instanceof Point !== true)
|
||||||
this.log.warning('Called `Point.flipY(that)` but `that` is not a `Point` object')
|
this.log.warn('Called `Point.flipY(that)` but `that` is not a `Point` object')
|
||||||
that.__check()
|
that.__check()
|
||||||
}
|
}
|
||||||
if (that === false || that.y === 0) return new Point(this.x, this.y * -1).__withLog(this.log)
|
if (that === false || that.y === 0) return new Point(this.x, this.y * -1).__withLog(this.log)
|
||||||
|
@ -177,9 +177,9 @@ Point.prototype.flipY = function (that = false) {
|
||||||
*/
|
*/
|
||||||
Point.prototype.rotate = function (deg, that) {
|
Point.prototype.rotate = function (deg, that) {
|
||||||
if (typeof deg !== 'number')
|
if (typeof deg !== 'number')
|
||||||
this.log.warning('Called `Point.rotate(deg,that)` but `deg` is not a number')
|
this.log.warn('Called `Point.rotate(deg,that)` but `deg` is not a number')
|
||||||
if (that instanceof Point !== true)
|
if (that instanceof Point !== true)
|
||||||
this.log.warning('Called `Point.rotate(deg,that)` but `that` is not a `Point` object')
|
this.log.warn('Called `Point.rotate(deg,that)` but `that` is not a `Point` object')
|
||||||
const radius = this.__check().dist(that.__check())
|
const radius = this.__check().dist(that.__check())
|
||||||
const angle = this.angle(that)
|
const angle = this.angle(that)
|
||||||
const x = that.x + radius * Math.cos(deg2rad(angle + deg)) * -1
|
const x = that.x + radius * Math.cos(deg2rad(angle + deg)) * -1
|
||||||
|
@ -241,11 +241,11 @@ Point.prototype.shift = function (deg, dist) {
|
||||||
*/
|
*/
|
||||||
Point.prototype.shiftFractionTowards = function (that, fraction) {
|
Point.prototype.shiftFractionTowards = function (that, fraction) {
|
||||||
if (that instanceof Point !== true)
|
if (that instanceof Point !== true)
|
||||||
this.log.warning(
|
this.log.warn(
|
||||||
'Called `Point.shiftFractionTowards(that, fraction)` but `that` is not a `Point` object'
|
'Called `Point.shiftFractionTowards(that, fraction)` but `that` is not a `Point` object'
|
||||||
)
|
)
|
||||||
if (typeof fraction !== 'number')
|
if (typeof fraction !== 'number')
|
||||||
this.log.warning('Called `Point.shiftFractionTowards` but `fraction` is not a number')
|
this.log.warn('Called `Point.shiftFractionTowards` but `fraction` is not a number')
|
||||||
|
|
||||||
return this.__check().shiftTowards(that.__check(), this.dist(that) * fraction)
|
return this.__check().shiftTowards(that.__check(), this.dist(that) * fraction)
|
||||||
}
|
}
|
||||||
|
@ -260,9 +260,7 @@ Point.prototype.shiftFractionTowards = function (that, fraction) {
|
||||||
Point.prototype.shiftOutwards = function (that, distance) {
|
Point.prototype.shiftOutwards = function (that, distance) {
|
||||||
distance = __asNumber(distance, 'distance', 'Point.shiftOutwards', this.log)
|
distance = __asNumber(distance, 'distance', 'Point.shiftOutwards', this.log)
|
||||||
if (that instanceof Point !== true)
|
if (that instanceof Point !== true)
|
||||||
this.log.warning(
|
this.log.warn('Called `Point.shiftOutwards(that, distance)` but `that` is not a `Point` object')
|
||||||
'Called `Point.shiftOutwards(that, distance)` but `that` is not a `Point` object'
|
|
||||||
)
|
|
||||||
this.__check()
|
this.__check()
|
||||||
that.__check()
|
that.__check()
|
||||||
|
|
||||||
|
@ -279,9 +277,7 @@ Point.prototype.shiftOutwards = function (that, distance) {
|
||||||
Point.prototype.shiftTowards = function (that, dist) {
|
Point.prototype.shiftTowards = function (that, dist) {
|
||||||
dist = __asNumber(dist, 'dist', 'Point.shiftTowards', this.log)
|
dist = __asNumber(dist, 'dist', 'Point.shiftTowards', this.log)
|
||||||
if (that instanceof Point !== true)
|
if (that instanceof Point !== true)
|
||||||
this.log.warning(
|
this.log.warn('Called `Point.shiftTowards(that, distance)` but `that` is not a `Point` object')
|
||||||
'Called `Point.shiftTowards(that, distance)` but `that` is not a `Point` object'
|
|
||||||
)
|
|
||||||
|
|
||||||
return this.__check().shift(this.angle(that.__check()), dist)
|
return this.__check().shift(this.angle(that.__check()), dist)
|
||||||
}
|
}
|
||||||
|
@ -294,7 +290,7 @@ Point.prototype.shiftTowards = function (that, dist) {
|
||||||
*/
|
*/
|
||||||
Point.prototype.sitsOn = function (that) {
|
Point.prototype.sitsOn = function (that) {
|
||||||
if (that instanceof Point !== true)
|
if (that instanceof Point !== true)
|
||||||
this.log.warning('Called `Point.sitsOn(that)` but `that` is not a `Point` object')
|
this.log.warn('Called `Point.sitsOn(that)` but `that` is not a `Point` object')
|
||||||
if (this.__check().x === that.__check().x && this.y === that.y) return true
|
if (this.__check().x === that.__check().x && this.y === that.y) return true
|
||||||
else return false
|
else return false
|
||||||
}
|
}
|
||||||
|
@ -307,7 +303,7 @@ Point.prototype.sitsOn = function (that) {
|
||||||
*/
|
*/
|
||||||
Point.prototype.sitsRoughlyOn = function (that) {
|
Point.prototype.sitsRoughlyOn = function (that) {
|
||||||
if (that instanceof Point !== true)
|
if (that instanceof Point !== true)
|
||||||
this.log.warning('Called `Point.sitsRoughlyOn(that)` but `that` is not a `Point` object')
|
this.log.warn('Called `Point.sitsRoughlyOn(that)` but `that` is not a `Point` object')
|
||||||
if (
|
if (
|
||||||
Math.round(this.__check().x) === Math.round(that.__check().x) &&
|
Math.round(this.__check().x) === Math.round(that.__check().x) &&
|
||||||
Math.round(this.y) === Math.round(that.y)
|
Math.round(this.y) === Math.round(that.y)
|
||||||
|
@ -335,10 +331,8 @@ Point.prototype.slope = function (that) {
|
||||||
*/
|
*/
|
||||||
Point.prototype.translate = function (x, y) {
|
Point.prototype.translate = function (x, y) {
|
||||||
this.__check()
|
this.__check()
|
||||||
if (typeof x !== 'number')
|
if (typeof x !== 'number') this.log.warn('Called `Point.translate(x,y)` but `x` is not a number')
|
||||||
this.log.warning('Called `Point.translate(x,y)` but `x` is not a number')
|
if (typeof y !== 'number') this.log.warn('Called `Point.translate(x,y)` but `y` is not a number')
|
||||||
if (typeof y !== 'number')
|
|
||||||
this.log.warning('Called `Point.translate(x,y)` but `y` is not a number')
|
|
||||||
const p = this.copy()
|
const p = this.copy()
|
||||||
p.x += x
|
p.x += x
|
||||||
p.y += y
|
p.y += y
|
||||||
|
@ -370,8 +364,8 @@ Point.prototype.asRenderProps = function () {
|
||||||
* @return {object} this - The Point instance
|
* @return {object} this - The Point instance
|
||||||
*/
|
*/
|
||||||
Point.prototype.__check = function () {
|
Point.prototype.__check = function () {
|
||||||
if (typeof this.x !== 'number') this.log.warning('X value of `Point` is not a number')
|
if (typeof this.x !== 'number') this.log.warn('X value of `Point` is not a number')
|
||||||
if (typeof this.y !== 'number') this.log.warning('Y value of `Point` is not a number')
|
if (typeof this.y !== 'number') this.log.warn('Y value of `Point` is not a number')
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
@ -409,15 +403,15 @@ export function pointsProxy(points, log) {
|
||||||
set: (points, name, value) => {
|
set: (points, name, value) => {
|
||||||
// Constructor checks
|
// Constructor checks
|
||||||
if (value instanceof Point !== true)
|
if (value instanceof Point !== true)
|
||||||
log.warning(`\`points.${name}\` was set with a value that is not a \`Point\` object`)
|
log.warn(`\`points.${name}\` was set with a value that is not a \`Point\` object`)
|
||||||
if (value.x == null || !__isCoord(value.x))
|
if (value.x == null || !__isCoord(value.x))
|
||||||
log.warning(`\`points.${name}\` was set with a \`x\` parameter that is not a \`number\``)
|
log.warn(`\`points.${name}\` was set with a \`x\` parameter that is not a \`number\``)
|
||||||
if (value.y == null || !__isCoord(value.y))
|
if (value.y == null || !__isCoord(value.y))
|
||||||
log.warning(`\`points.${name}\` was set with a \`y\` parameter that is not a \`number\``)
|
log.warn(`\`points.${name}\` was set with a \`y\` parameter that is not a \`number\``)
|
||||||
try {
|
try {
|
||||||
value.name = name
|
value.name = name
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.warning(`Could not set \`name\` property on \`points.${name}\``)
|
log.warn(`Could not set \`name\` property on \`points.${name}\``)
|
||||||
}
|
}
|
||||||
return (points[name] = value)
|
return (points[name] = value)
|
||||||
},
|
},
|
||||||
|
|
|
@ -125,19 +125,17 @@ export function snippetsProxy(snippets, log) {
|
||||||
set: (snippets, name, value) => {
|
set: (snippets, name, value) => {
|
||||||
// Constructor checks
|
// Constructor checks
|
||||||
if (value instanceof Snippet !== true)
|
if (value instanceof Snippet !== true)
|
||||||
log.warning(`\`snippets.${name}\` was set with a value that is not a \`Snippet\` object`)
|
log.warn(`\`snippets.${name}\` was set with a value that is not a \`Snippet\` object`)
|
||||||
if (typeof value.def !== 'string')
|
if (typeof value.def !== 'string')
|
||||||
log.warning(
|
log.warn(`\`snippets.${name}\` was set with a \`def\` parameter that is not a \`string\``)
|
||||||
`\`snippets.${name}\` was set with a \`def\` parameter that is not a \`string\``
|
|
||||||
)
|
|
||||||
if (value.anchor instanceof Point !== true)
|
if (value.anchor instanceof Point !== true)
|
||||||
log.warning(
|
log.warn(
|
||||||
`\`snippets.${name}\` was set with an \`anchor\` parameter that is not a \`Point\``
|
`\`snippets.${name}\` was set with an \`anchor\` parameter that is not a \`Point\``
|
||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
value.name = name
|
value.name = name
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.warning(`Could not set \`name\` property on \`snippets.${name}\``)
|
log.warn(`Could not set \`name\` property on \`snippets.${name}\``)
|
||||||
}
|
}
|
||||||
return (snippets[name] = value)
|
return (snippets[name] = value)
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,7 +24,9 @@ export function Store(methods = []) {
|
||||||
const logs = {
|
const logs = {
|
||||||
debug: [],
|
debug: [],
|
||||||
info: [],
|
info: [],
|
||||||
|
// FIXME: Remove after migration to 'warn' is complete
|
||||||
warning: [],
|
warning: [],
|
||||||
|
warn: [],
|
||||||
error: [],
|
error: [],
|
||||||
}
|
}
|
||||||
this.log = {
|
this.log = {
|
||||||
|
@ -34,6 +36,10 @@ export function Store(methods = []) {
|
||||||
info: function (...data) {
|
info: function (...data) {
|
||||||
logs.info.push(...data)
|
logs.info.push(...data)
|
||||||
},
|
},
|
||||||
|
warn: function (...data) {
|
||||||
|
logs.warn.push(...data)
|
||||||
|
},
|
||||||
|
// FIXME: Remove after migration to 'warn' is complete
|
||||||
warning: function (...data) {
|
warning: function (...data) {
|
||||||
logs.warning.push(...data)
|
logs.warning.push(...data)
|
||||||
},
|
},
|
||||||
|
@ -46,7 +52,7 @@ export function Store(methods = []) {
|
||||||
|
|
||||||
for (const [path, method] of methods) {
|
for (const [path, method] of methods) {
|
||||||
if (avoid.indexOf(path) !== -1) {
|
if (avoid.indexOf(path) !== -1) {
|
||||||
this.log.warning(`You cannot overwrite \`store.${path}()\``)
|
this.log.warn(`You cannot overwrite \`store.${path}()\``)
|
||||||
} else set(this, path, method)
|
} else set(this, path, method)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +72,7 @@ export function Store(methods = []) {
|
||||||
Store.prototype.extend = function (methods) {
|
Store.prototype.extend = function (methods) {
|
||||||
for (const [path, method] of methods) {
|
for (const [path, method] of methods) {
|
||||||
if (avoid.indexOf(path) !== -1) {
|
if (avoid.indexOf(path) !== -1) {
|
||||||
this.log.warning(`You cannot overwrite \`store.${path}()\``)
|
this.log.warn(`You cannot overwrite \`store.${path}()\``)
|
||||||
} else {
|
} else {
|
||||||
this.log.info(`Extending store with \`${path}\``)
|
this.log.info(`Extending store with \`${path}\``)
|
||||||
set(this, path, (...args) => method(this, ...args))
|
set(this, path, (...args) => method(this, ...args))
|
||||||
|
@ -86,7 +92,7 @@ Store.prototype.extend = function (methods) {
|
||||||
Store.prototype.get = function (path, dflt) {
|
Store.prototype.get = function (path, dflt) {
|
||||||
const val = get(this, path, dflt)
|
const val = get(this, path, dflt)
|
||||||
if (typeof val === 'undefined') {
|
if (typeof val === 'undefined') {
|
||||||
this.log.warning(`Store.get(key) on key \`${path}\`, which is undefined`)
|
this.log.warn(`Store.get(key) on key \`${path}\`, which is undefined`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return val
|
return val
|
||||||
|
@ -104,7 +110,7 @@ Store.prototype.push = function (path, ...values) {
|
||||||
if (Array.isArray(arr)) {
|
if (Array.isArray(arr)) {
|
||||||
return this.set(path, [...arr, ...values])
|
return this.set(path, [...arr, ...values])
|
||||||
} else {
|
} else {
|
||||||
this.log.warning(`Store.push(value) on key \`${path}\`, but key does not hold an array`)
|
this.log.warn(`Store.push(value) on key \`${path}\`, but key does not hold an array`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
@ -119,7 +125,7 @@ Store.prototype.push = function (path, ...values) {
|
||||||
*/
|
*/
|
||||||
Store.prototype.set = function (path, value) {
|
Store.prototype.set = function (path, value) {
|
||||||
if (typeof value === 'undefined') {
|
if (typeof value === 'undefined') {
|
||||||
this.log.warning(`Store.set(value) on key \`${path}\`, but value is undefined`)
|
this.log.warn(`Store.set(value) on key \`${path}\`, but value is undefined`)
|
||||||
}
|
}
|
||||||
set(this, path, value)
|
set(this, path, value)
|
||||||
|
|
||||||
|
@ -135,7 +141,7 @@ Store.prototype.set = function (path, value) {
|
||||||
*/
|
*/
|
||||||
Store.prototype.setIfUnset = function (path, value) {
|
Store.prototype.setIfUnset = function (path, value) {
|
||||||
if (typeof value === 'undefined') {
|
if (typeof value === 'undefined') {
|
||||||
this.log.warning(`Store.setIfUnset(value) on key \`${path}\`, but value is undefined`)
|
this.log.warn(`Store.setIfUnset(value) on key \`${path}\`, but value is undefined`)
|
||||||
}
|
}
|
||||||
if (typeof get(this, path) === 'undefined') {
|
if (typeof get(this, path) === 'undefined') {
|
||||||
return set(this, path, value)
|
return set(this, path, value)
|
||||||
|
|
|
@ -693,7 +693,7 @@ export function __addNonEnumProp(obj, name, value) {
|
||||||
export function __asNumber(value, param, method, log) {
|
export function __asNumber(value, param, method, log) {
|
||||||
if (typeof value === 'number') return value
|
if (typeof value === 'number') return value
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
log.warning(
|
log.warn(
|
||||||
`Called \`${method}(${param})\` but \`${param}\` is not a number. Will attempt to cast to Number`
|
`Called \`${method}(${param})\` but \`${param}\` is not a number. Will attempt to cast to Number`
|
||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -124,14 +124,14 @@ describe('Part', () => {
|
||||||
const design = new Design({ parts: [part] })
|
const design = new Design({ parts: [part] })
|
||||||
const pattern = new design()
|
const pattern = new design()
|
||||||
pattern.draft()
|
pattern.draft()
|
||||||
expect(pattern.setStores[0].logs.warning.length).to.equal(4)
|
expect(pattern.setStores[0].logs.warn.length).to.equal(4)
|
||||||
expect(pattern.setStores[0].logs.warning[0]).to.equal(
|
expect(pattern.setStores[0].logs.warn[0]).to.equal(
|
||||||
'`points.a` was set with a value that is not a `Point` object'
|
'`points.a` was set with a value that is not a `Point` object'
|
||||||
)
|
)
|
||||||
expect(pattern.setStores[0].logs.warning[1]).to.equal(
|
expect(pattern.setStores[0].logs.warn[1]).to.equal(
|
||||||
'`points.a` was set with a `x` parameter that is not a `number`'
|
'`points.a` was set with a `x` parameter that is not a `number`'
|
||||||
)
|
)
|
||||||
expect(pattern.setStores[0].logs.warning[2]).to.equal(
|
expect(pattern.setStores[0].logs.warn[2]).to.equal(
|
||||||
'`points.a` was set with a `y` parameter that is not a `number`'
|
'`points.a` was set with a `y` parameter that is not a `number`'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -147,14 +147,14 @@ describe('Part', () => {
|
||||||
const design = new Design({ parts: [part] })
|
const design = new Design({ parts: [part] })
|
||||||
const pattern = new design()
|
const pattern = new design()
|
||||||
pattern.draft()
|
pattern.draft()
|
||||||
expect(pattern.setStores[0].logs.warning.length).to.equal(4)
|
expect(pattern.setStores[0].logs.warn.length).to.equal(4)
|
||||||
expect(pattern.setStores[0].logs.warning[0]).to.equal(
|
expect(pattern.setStores[0].logs.warn[0]).to.equal(
|
||||||
'`snippets.a` was set with a value that is not a `Snippet` object'
|
'`snippets.a` was set with a value that is not a `Snippet` object'
|
||||||
)
|
)
|
||||||
expect(pattern.setStores[0].logs.warning[1]).to.equal(
|
expect(pattern.setStores[0].logs.warn[1]).to.equal(
|
||||||
'`snippets.a` was set with a `def` parameter that is not a `string`'
|
'`snippets.a` was set with a `def` parameter that is not a `string`'
|
||||||
)
|
)
|
||||||
expect(pattern.setStores[0].logs.warning[2]).to.equal(
|
expect(pattern.setStores[0].logs.warn[2]).to.equal(
|
||||||
'`snippets.a` was set with an `anchor` parameter that is not a `Point`'
|
'`snippets.a` was set with an `anchor` parameter that is not a `Point`'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -197,8 +197,8 @@ describe('Part', () => {
|
||||||
// Let's also cover the branch where complete is false
|
// Let's also cover the branch where complete is false
|
||||||
const pattern = new design({ complete: false })
|
const pattern = new design({ complete: false })
|
||||||
pattern.draft()
|
pattern.draft()
|
||||||
expect(pattern.setStores[0].logs.warning.length).to.equal(1)
|
expect(pattern.setStores[0].logs.warn.length).to.equal(1)
|
||||||
expect(pattern.setStores[0].logs.warning[0]).to.equal(
|
expect(pattern.setStores[0].logs.warn[0]).to.equal(
|
||||||
'Calling `units(value)` but `value` is not a number (`string`)'
|
'Calling `units(value)` but `value` is not a number (`string`)'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -311,8 +311,8 @@ describe('Part', () => {
|
||||||
const design = new Design({ parts: [part] })
|
const design = new Design({ parts: [part] })
|
||||||
const pattern = new design()
|
const pattern = new design()
|
||||||
pattern.draft()
|
pattern.draft()
|
||||||
expect(pattern.setStores[0].logs.warning.length).to.equal(1)
|
expect(pattern.setStores[0].logs.warn.length).to.equal(1)
|
||||||
expect(pattern.setStores[0].logs.warning[0]).to.equal(
|
expect(pattern.setStores[0].logs.warn[0]).to.equal(
|
||||||
'Tried to access `options.test` but it is `undefined`'
|
'Tried to access `options.test` but it is `undefined`'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -328,8 +328,8 @@ describe('Part', () => {
|
||||||
const design = new Design({ parts: [part] })
|
const design = new Design({ parts: [part] })
|
||||||
const pattern = new design()
|
const pattern = new design()
|
||||||
pattern.draft()
|
pattern.draft()
|
||||||
expect(pattern.setStores[0].logs.warning.length).to.equal(1)
|
expect(pattern.setStores[0].logs.warn.length).to.equal(1)
|
||||||
expect(pattern.setStores[0].logs.warning[0]).to.equal(
|
expect(pattern.setStores[0].logs.warn[0]).to.equal(
|
||||||
'Tried to access `absoluteOptions.test` but it is `undefined`'
|
'Tried to access `absoluteOptions.test` but it is `undefined`'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -49,7 +49,7 @@ describe('Path', () => {
|
||||||
points.to = new Point(90, 20)
|
points.to = new Point(90, 20)
|
||||||
|
|
||||||
const messages = []
|
const messages = []
|
||||||
const log = { warning: (msg) => messages.push(msg) }
|
const log = { warn: (msg) => messages.push(msg) }
|
||||||
new Path()
|
new Path()
|
||||||
.__withLog(log)
|
.__withLog(log)
|
||||||
.move(points.from)
|
.move(points.from)
|
||||||
|
@ -62,7 +62,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when passing a non-Point to smurve_()', () => {
|
it('Should log a warning when passing a non-Point to smurve_()', () => {
|
||||||
const messages = []
|
const messages = []
|
||||||
const log = { warning: (msg) => messages.push(msg) }
|
const log = { warn: (msg) => messages.push(msg) }
|
||||||
try {
|
try {
|
||||||
new Path().__withLog(log).smurve_('hi')
|
new Path().__withLog(log).smurve_('hi')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -76,7 +76,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when passing a non-Path to the paths proxy', () => {
|
it('Should log a warning when passing a non-Path to the paths proxy', () => {
|
||||||
const messages = []
|
const messages = []
|
||||||
const log = { warning: (msg) => messages.push(msg) }
|
const log = { warn: (msg) => messages.push(msg) }
|
||||||
const pathsObj = {}
|
const pathsObj = {}
|
||||||
const paths = pathsProxy(pathsObj, log)
|
const paths = pathsProxy(pathsObj, log)
|
||||||
paths.set(pathsObj, 'test', 'Writing code can get very lonely sometimes')
|
paths.set(pathsObj, 'test', 'Writing code can get very lonely sometimes')
|
||||||
|
@ -685,7 +685,7 @@ describe('Path', () => {
|
||||||
it('Calling translate with non-numbers should generate a warning', () => {
|
it('Calling translate with non-numbers should generate a warning', () => {
|
||||||
const log = []
|
const log = []
|
||||||
const p = new Path()
|
const p = new Path()
|
||||||
p.log = { warning: (msg) => log.push(msg) }
|
p.log = { warn: (msg) => log.push(msg) }
|
||||||
p.translate('a', 'b')
|
p.translate('a', 'b')
|
||||||
expect(log.length).to.equal(2)
|
expect(log.length).to.equal(2)
|
||||||
expect(log[0]).to.equal('Called `Path.translate(x, y)` but `x` is not a number')
|
expect(log[0]).to.equal('Called `Path.translate(x, y)` but `x` is not a number')
|
||||||
|
@ -756,7 +756,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when moving to a non-point', () => {
|
it('Should log a warning when moving to a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Path().__withLog(log)
|
const p1 = new Path().__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -769,7 +769,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when drawing a line to a non-point', () => {
|
it('Should log a warning when drawing a line to a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Path().__withLog(log)
|
const p1 = new Path().__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -782,7 +782,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when drawing a curve to a non-point', () => {
|
it('Should log a warning when drawing a curve to a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Path().__withLog(log)
|
const p1 = new Path().__withLog(log)
|
||||||
const a = new Point(0, 0)
|
const a = new Point(0, 0)
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
|
@ -797,7 +797,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when drawing a curve with a Cp1 that is a non-point', () => {
|
it('Should log a warning when drawing a curve with a Cp1 that is a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Path().__withLog(log)
|
const p1 = new Path().__withLog(log)
|
||||||
const a = new Point(0, 0)
|
const a = new Point(0, 0)
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
|
@ -812,7 +812,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when drawing a curve with a Cp1 that is a non-point', () => {
|
it('Should log a warning when drawing a curve with a Cp1 that is a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Path().__withLog(log)
|
const p1 = new Path().__withLog(log)
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
|
@ -826,7 +826,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when drawing a curve with a Cp2 that is a non-point', () => {
|
it('Should log a warning when drawing a curve with a Cp2 that is a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Path().__withLog(log)
|
const p1 = new Path().__withLog(log)
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
|
@ -840,7 +840,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when drawing a _curve with a To that is a non-point', () => {
|
it('Should log a warning when drawing a _curve with a To that is a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Path().__withLog(log)
|
const p1 = new Path().__withLog(log)
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
|
@ -854,7 +854,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when drawing a _curve with a Cp2 that is a non-point', () => {
|
it('Should log a warning when drawing a _curve with a Cp2 that is a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Path().__withLog(log)
|
const p1 = new Path().__withLog(log)
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
|
@ -868,7 +868,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when drawing a curve_ with a To that is a non-point', () => {
|
it('Should log a warning when drawing a curve_ with a To that is a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Path().__withLog(log)
|
const p1 = new Path().__withLog(log)
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
|
@ -882,7 +882,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when drawing a curve_ with a Cp2 that is a non-point', () => {
|
it('Should log a warning when drawing a curve_ with a Cp2 that is a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Path().__withLog(log)
|
const p1 = new Path().__withLog(log)
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
|
@ -912,7 +912,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when an insop operation used an falsy ID', () => {
|
it('Should log a warning when an insop operation used an falsy ID', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const a = new Point(0, 0)
|
const a = new Point(0, 0)
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
const p1 = new Path().move(a).line(b)
|
const p1 = new Path().move(a).line(b)
|
||||||
|
@ -923,7 +923,7 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when an insop operation used an falsy ID', () => {
|
it('Should log a warning when an insop operation used an falsy ID', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const a = new Point(0, 0)
|
const a = new Point(0, 0)
|
||||||
const b = new Point(10, 10)
|
const b = new Point(10, 10)
|
||||||
new Path().move(a).line(b)
|
new Path().move(a).line(b)
|
||||||
|
@ -938,21 +938,21 @@ describe('Path', () => {
|
||||||
|
|
||||||
it('Should log a warning when setting an attribute without a name', () => {
|
it('Should log a warning when setting an attribute without a name', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
new Path().__withLog(log).attr()
|
new Path().__withLog(log).attr()
|
||||||
expect(invalid).to.equal(true)
|
expect(invalid).to.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should log a warning when setting an attribute without a value', () => {
|
it('Should log a warning when setting an attribute without a value', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
new Path().__withLog(log).attr('test')
|
new Path().__withLog(log).attr('test')
|
||||||
expect(invalid).to.equal(true)
|
expect(invalid).to.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should log an error when calling offset without a distance', () => {
|
it('Should log an error when calling offset without a distance', () => {
|
||||||
let invalid = true
|
let invalid = true
|
||||||
const log = { warning: () => {}, error: () => (invalid = true) }
|
const log = { warn: () => {}, error: () => (invalid = true) }
|
||||||
const pointLog = { error: () => {} }
|
const pointLog = { error: () => {} }
|
||||||
const pointA = new Point(0, 0).__withLog(pointLog)
|
const pointA = new Point(0, 0).__withLog(pointLog)
|
||||||
const pointB = new Point(0, 40).__withLog(pointLog)
|
const pointB = new Point(0, 40).__withLog(pointLog)
|
||||||
|
@ -1019,7 +1019,7 @@ describe('Path', () => {
|
||||||
it('Should log an error when splitting a path on a non-point', () => {
|
it('Should log an error when splitting a path on a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { error: () => (invalid = true) }
|
const log = { error: () => (invalid = true) }
|
||||||
const pointLog = { warning: () => {} }
|
const pointLog = { warn: () => {} }
|
||||||
try {
|
try {
|
||||||
new Path()
|
new Path()
|
||||||
.__withLog(log)
|
.__withLog(log)
|
||||||
|
|
|
@ -222,8 +222,8 @@ describe('Pattern', () => {
|
||||||
const pattern = new Pattern()
|
const pattern = new Pattern()
|
||||||
pattern.events.error.push('error')
|
pattern.events.error.push('error')
|
||||||
pattern.pack()
|
pattern.pack()
|
||||||
expect(pattern.events.warning.length).to.equal(1)
|
expect(pattern.events.warn.length).to.equal(1)
|
||||||
expect(pattern.events.warning[0]).to.equal(
|
expect(pattern.events.warn[0]).to.equal(
|
||||||
'One or more errors occured. Not packing pattern parts'
|
'One or more errors occured. Not packing pattern parts'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -867,12 +867,12 @@ describe('Pattern', () => {
|
||||||
expect(typeof partContext.store.log).to.equal('object')
|
expect(typeof partContext.store.log).to.equal('object')
|
||||||
expect(typeof partContext.store.log.debug).to.equal('function')
|
expect(typeof partContext.store.log.debug).to.equal('function')
|
||||||
expect(typeof partContext.store.log.info).to.equal('function')
|
expect(typeof partContext.store.log.info).to.equal('function')
|
||||||
expect(typeof partContext.store.log.warning).to.equal('function')
|
expect(typeof partContext.store.log.warn).to.equal('function')
|
||||||
expect(typeof partContext.store.log.error).to.equal('function')
|
expect(typeof partContext.store.log.error).to.equal('function')
|
||||||
expect(typeof partContext.store.logs).to.equal('object')
|
expect(typeof partContext.store.logs).to.equal('object')
|
||||||
expect(Array.isArray(partContext.store.logs.debug)).to.equal(true)
|
expect(Array.isArray(partContext.store.logs.debug)).to.equal(true)
|
||||||
expect(Array.isArray(partContext.store.logs.info)).to.equal(true)
|
expect(Array.isArray(partContext.store.logs.info)).to.equal(true)
|
||||||
expect(Array.isArray(partContext.store.logs.warning)).to.equal(true)
|
expect(Array.isArray(partContext.store.logs.warn)).to.equal(true)
|
||||||
expect(Array.isArray(partContext.store.logs.error)).to.equal(true)
|
expect(Array.isArray(partContext.store.logs.error)).to.equal(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -239,8 +239,8 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning on invalid point coordinates', () => {
|
it('Should log a warning on invalid point coordinates', () => {
|
||||||
const invalid = { x: false, y: false }
|
const invalid = { x: false, y: false }
|
||||||
const logX = { warning: () => (invalid.x = true) }
|
const logX = { warn: () => (invalid.x = true) }
|
||||||
const logY = { warning: () => (invalid.y = true) }
|
const logY = { warn: () => (invalid.y = true) }
|
||||||
const p1 = new Point('a', 10).__withLog(logX)
|
const p1 = new Point('a', 10).__withLog(logX)
|
||||||
const p2 = new Point(20, 'b').__withLog(logY)
|
const p2 = new Point(20, 'b').__withLog(logY)
|
||||||
expect(invalid.x).to.equal(false)
|
expect(invalid.x).to.equal(false)
|
||||||
|
@ -253,7 +253,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning if rotation is not a number', () => {
|
it('Should log a warning if rotation is not a number', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
const p2 = new Point(20, 20).__withLog(log)
|
const p2 = new Point(20, 20).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
|
@ -263,7 +263,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning if rotating around what is not a point', () => {
|
it('Should log a warning if rotating around what is not a point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -276,7 +276,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it("Should log a warning when flipX'ing around what is not a point", () => {
|
it("Should log a warning when flipX'ing around what is not a point", () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -289,7 +289,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it("Should log a warning when flipY'ing around what is not a point", () => {
|
it("Should log a warning when flipY'ing around what is not a point", () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -302,7 +302,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when shifting with a distance that is not a number', () => {
|
it('Should log a warning when shifting with a distance that is not a number', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -315,7 +315,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when shifting with an angle that is not a number', () => {
|
it('Should log a warning when shifting with an angle that is not a number', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -328,7 +328,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when shifting towards with a distance that is not a number', () => {
|
it('Should log a warning when shifting towards with a distance that is not a number', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
const p2 = new Point(20, 20).__withLog(log)
|
const p2 = new Point(20, 20).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
|
@ -342,7 +342,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when shifting towards with a target that is not a point', () => {
|
it('Should log a warning when shifting towards with a target that is not a point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -355,7 +355,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when shifting fraction towards with a distance that is not a number', () => {
|
it('Should log a warning when shifting fraction towards with a distance that is not a number', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
const p2 = new Point(20, 20).__withLog(log)
|
const p2 = new Point(20, 20).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
|
@ -369,7 +369,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when shifting a fraction towards with a target that is not a point', () => {
|
it('Should log a warning when shifting a fraction towards with a target that is not a point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -382,7 +382,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when shifting outowards with a distance that is not a number', () => {
|
it('Should log a warning when shifting outowards with a distance that is not a number', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
const p2 = new Point(20, 20).__withLog(log)
|
const p2 = new Point(20, 20).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
|
@ -396,7 +396,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when shifting a outowards with a target that is not a point', () => {
|
it('Should log a warning when shifting a outowards with a target that is not a point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -409,7 +409,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when translating with an X-delta that is not a number', () => {
|
it('Should log a warning when translating with an X-delta that is not a number', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -422,7 +422,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when translating with an Y-delta that is not a number', () => {
|
it('Should log a warning when translating with an Y-delta that is not a number', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -435,7 +435,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when sitsOn receives a non-point', () => {
|
it('Should log a warning when sitsOn receives a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
@ -448,7 +448,7 @@ describe('Point', () => {
|
||||||
|
|
||||||
it('Should log a warning when sitsRoughlyOn receives a non-point', () => {
|
it('Should log a warning when sitsRoughlyOn receives a non-point', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { warning: () => (invalid = true) }
|
const log = { warn: () => (invalid = true) }
|
||||||
const p1 = new Point(10, 10).__withLog(log)
|
const p1 = new Point(10, 10).__withLog(log)
|
||||||
expect(invalid).to.equal(false)
|
expect(invalid).to.equal(false)
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -32,10 +32,8 @@ describe('Store', () => {
|
||||||
it('Should emit a warning when retrieving a invalid key', () => {
|
it('Should emit a warning when retrieving a invalid key', () => {
|
||||||
const store = new Store()
|
const store = new Store()
|
||||||
store.get('nope')
|
store.get('nope')
|
||||||
expect(store.get('logs.warning').length).to.equal(1)
|
expect(store.get('logs.warn').length).to.equal(1)
|
||||||
expect(store.get('logs.warning')[0]).to.equal(
|
expect(store.get('logs.warn')[0]).to.equal('Store.get(key) on key `nope`, which is undefined')
|
||||||
'Store.get(key) on key `nope`, which is undefined'
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should add methods to the store from a plugin', () => {
|
it('Should add methods to the store from a plugin', () => {
|
||||||
|
@ -44,9 +42,9 @@ describe('Store', () => {
|
||||||
version: 1,
|
version: 1,
|
||||||
store: [
|
store: [
|
||||||
[
|
[
|
||||||
'test.example.warning',
|
'test.example.warn',
|
||||||
function (store, msg) {
|
function (store, msg) {
|
||||||
store.set('test.message.warning', msg)
|
store.set('test.message.warn', msg)
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -61,7 +59,7 @@ describe('Store', () => {
|
||||||
name: 'example.part',
|
name: 'example.part',
|
||||||
plugins: [plugin],
|
plugins: [plugin],
|
||||||
draft: ({ store, part }) => {
|
draft: ({ store, part }) => {
|
||||||
store.test.example.warning('hello warning')
|
store.test.example.warn('hello warn')
|
||||||
store.test.example.info('hello info')
|
store.test.example.info('hello info')
|
||||||
|
|
||||||
return part
|
return part
|
||||||
|
@ -70,21 +68,21 @@ describe('Store', () => {
|
||||||
const Test = new Design({ parts: [part] })
|
const Test = new Design({ parts: [part] })
|
||||||
const pattern = new Test()
|
const pattern = new Test()
|
||||||
pattern.draft()
|
pattern.draft()
|
||||||
expect(pattern.setStores[0].get('test.message.warning')).to.equal('hello warning')
|
expect(pattern.setStores[0].get('test.message.warn')).to.equal('hello warn')
|
||||||
expect(pattern.setStores[0].get('test.message.info')).to.equal('hello info')
|
expect(pattern.setStores[0].get('test.message.info')).to.equal('hello info')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should log a warning when trying to extend a protected method via the constructor', () => {
|
it('Should log a warning when trying to extend a protected method via the constructor', () => {
|
||||||
const store = new Store([['get', () => false]])
|
const store = new Store([['get', () => false]])
|
||||||
expect(store.logs.warning.length).to.equal(1)
|
expect(store.logs.warn.length).to.equal(1)
|
||||||
expect(store.logs.warning[0]).to.equal('You cannot overwrite `store.get()`')
|
expect(store.logs.warn[0]).to.equal('You cannot overwrite `store.get()`')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should log a warning when trying to extend a protected method via the extend', () => {
|
it('Should log a warning when trying to extend a protected method via the extend', () => {
|
||||||
const store = new Store()
|
const store = new Store()
|
||||||
store.extend([['get', () => false]])
|
store.extend([['get', () => false]])
|
||||||
expect(store.logs.warning.length).to.equal(1)
|
expect(store.logs.warn.length).to.equal(1)
|
||||||
expect(store.logs.warning[0]).to.equal('You cannot overwrite `store.get()`')
|
expect(store.logs.warn[0]).to.equal('You cannot overwrite `store.get()`')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should extend the store with a new method via the constructor', () => {
|
it('Should extend the store with a new method via the constructor', () => {
|
||||||
|
@ -95,8 +93,8 @@ describe('Store', () => {
|
||||||
it('Should log a warning when pushing to a non-array key', () => {
|
it('Should log a warning when pushing to a non-array key', () => {
|
||||||
const store = new Store()
|
const store = new Store()
|
||||||
store.push('test', 1)
|
store.push('test', 1)
|
||||||
expect(store.logs.warning.length).to.equal(1)
|
expect(store.logs.warn.length).to.equal(1)
|
||||||
expect(store.logs.warning[0]).to.equal(
|
expect(store.logs.warn[0]).to.equal(
|
||||||
'Store.push(value) on key `test`, but key does not hold an array'
|
'Store.push(value) on key `test`, but key does not hold an array'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -104,15 +102,15 @@ describe('Store', () => {
|
||||||
it('Should log a warning when setting an undefined value with set()', () => {
|
it('Should log a warning when setting an undefined value with set()', () => {
|
||||||
const store = new Store()
|
const store = new Store()
|
||||||
store.set('test')
|
store.set('test')
|
||||||
expect(store.logs.warning.length).to.equal(1)
|
expect(store.logs.warn.length).to.equal(1)
|
||||||
expect(store.logs.warning[0]).to.equal('Store.set(value) on key `test`, but value is undefined')
|
expect(store.logs.warn[0]).to.equal('Store.set(value) on key `test`, but value is undefined')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should log a warning when setting an undefined value with setIfUnset()', () => {
|
it('Should log a warning when setting an undefined value with setIfUnset()', () => {
|
||||||
const store = new Store()
|
const store = new Store()
|
||||||
store.setIfUnset('test')
|
store.setIfUnset('test')
|
||||||
expect(store.logs.warning.length).to.equal(1)
|
expect(store.logs.warn.length).to.equal(1)
|
||||||
expect(store.logs.warning[0]).to.equal(
|
expect(store.logs.warn[0]).to.equal(
|
||||||
'Store.setIfUnset(value) on key `test`, but value is undefined'
|
'Store.setIfUnset(value) on key `test`, but value is undefined'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue