lint fixes
This commit is contained in:
parent
5f37bd8c1f
commit
3243216369
2 changed files with 10 additions and 15 deletions
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
|
@ -63,7 +63,7 @@ jobs:
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import chai from 'chai'
|
import chai from 'chai'
|
||||||
import { round, Path, Point, Design } from '../src/index.mjs'
|
import { round, Path, Point } from '../src/index.mjs'
|
||||||
import { pathsProxy } from '../src/path.mjs'
|
import { pathsProxy } from '../src/path.mjs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
@ -48,10 +48,9 @@ describe('Path', () => {
|
||||||
points.cp2 = new Point(60, 30)
|
points.cp2 = new Point(60, 30)
|
||||||
points.to = new Point(90, 20)
|
points.to = new Point(90, 20)
|
||||||
|
|
||||||
let invalid = false
|
|
||||||
const messages = []
|
const messages = []
|
||||||
const log = { warning: (msg) => messages.push(msg) }
|
const log = { warning: (msg) => messages.push(msg) }
|
||||||
const test = new Path()
|
new Path()
|
||||||
.__withLog(log)
|
.__withLog(log)
|
||||||
.move(points.from)
|
.move(points.from)
|
||||||
.curve(points.cp1, points.cp2, points.to)
|
.curve(points.cp1, points.cp2, points.to)
|
||||||
|
@ -62,12 +61,12 @@ 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_()', () => {
|
||||||
let invalid = false
|
|
||||||
const messages = []
|
const messages = []
|
||||||
const log = { warning: (msg) => messages.push(msg) }
|
const log = { warning: (msg) => messages.push(msg) }
|
||||||
try {
|
try {
|
||||||
const test = new Path().__withLog(log).smurve_('hi')
|
new Path().__withLog(log).smurve_('hi')
|
||||||
} catch {
|
} catch (e) {
|
||||||
|
expect('' + e).to.contain("TypeError: Cannot read properties of undefined (reading 'cp2')")
|
||||||
} finally {
|
} finally {
|
||||||
expect(messages.length).to.equal(1)
|
expect(messages.length).to.equal(1)
|
||||||
expect(messages[0]).to.equal('Called `Path.smurve_(to)` but `to` is not a `Point` object')
|
expect(messages[0]).to.equal('Called `Path.smurve_(to)` but `to` is not a `Point` object')
|
||||||
|
@ -76,7 +75,6 @@ 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', () => {
|
||||||
let invalid = false
|
|
||||||
const messages = []
|
const messages = []
|
||||||
const log = { warning: (msg) => messages.push(msg) }
|
const log = { warning: (msg) => messages.push(msg) }
|
||||||
const pathsObj = {}
|
const pathsObj = {}
|
||||||
|
@ -949,7 +947,7 @@ describe('Path', () => {
|
||||||
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)
|
||||||
const a = new Path().__withLog(log).move(pointA).line(pointB)
|
const a = new Path().__withLog(log).move(pointA).line(pointB)
|
||||||
const b = a.offset()
|
a.offset()
|
||||||
expect(invalid).to.equal(true)
|
expect(invalid).to.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -964,7 +962,8 @@ describe('Path', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
line.join()
|
line.join()
|
||||||
} catch {
|
} catch (e) {
|
||||||
|
expect('' + e).to.contain("TypeError: Cannot read properties of undefined (reading 'ops')")
|
||||||
} finally {
|
} finally {
|
||||||
expect(invalid).to.equal(true)
|
expect(invalid).to.equal(true)
|
||||||
}
|
}
|
||||||
|
@ -1003,11 +1002,7 @@ describe('Path', () => {
|
||||||
it('Should log an error when calling shiftFractionalong but fraction is not a number', () => {
|
it('Should log an error when calling shiftFractionalong but fraction is not a number', () => {
|
||||||
let invalid = false
|
let invalid = false
|
||||||
const log = { error: () => (invalid = true) }
|
const log = { error: () => (invalid = true) }
|
||||||
const a = new Path()
|
new Path().__withLog(log).move(new Point(0, 0)).line(new Point(0, 40)).shiftFractionAlong()
|
||||||
.__withLog(log)
|
|
||||||
.move(new Point(0, 0))
|
|
||||||
.line(new Point(0, 40))
|
|
||||||
.shiftFractionAlong()
|
|
||||||
expect(invalid).to.equal(true)
|
expect(invalid).to.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue