diff --git a/package-lock.json b/package-lock.json index ddb02e2b9..cb5d86adb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2600,6 +2600,7 @@ "version": "1.4.730", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.730.tgz", "integrity": "sha512-oJRPo82XEqtQAobHpJIR3zW5YO3sSRRkPz2an4yxi1UvqhsGm54vR/wzTFV74a3soDOJ8CKW7ajOOX5ESzddwg==", + "dev": true }, "node_modules/emittery": { diff --git a/package.json b/package.json index d83c8cc82..2dfca9fa0 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,9 @@ "devDependencies": { "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0" - }, - -"jest": { - "testEnvironment": "jest-environment-jsdom" -} - + }, + "jest": { + "testEnvironment": "jest-environment-jsdom" + } } diff --git a/test/paths.test.js b/test/paths.test.js new file mode 100644 index 000000000..2fda396f6 --- /dev/null +++ b/test/paths.test.js @@ -0,0 +1,36 @@ + +let Path; +if (typeof Path2D === 'function' || typeof Path2D === 'object') { + Path = Path2D; +} else { + // Define a mock implementation for the Path object + Path = function() { + this.components = []; + }; + Path.prototype.contains = jest.fn(); + Path.prototype.stroke = jest.fn(); + Path.prototype.fill = jest.fn(); + Path.prototype.strokeAndFill = jest.fn(); +} + +describe('Path', () => { + it('should contain a contains method', () => { + const path = new Path(); + expect(typeof path.contains).toBe('function'); + }); + + it('should contain a stroke method', () => { + const path = new Path(); + expect(typeof path.stroke).toBe('function'); + }); + + it('should contain a fill method', () => { + const path = new Path(); + expect(typeof path.fill).toBe('function'); + }); + + it('should contain a strokeAndFill method', () => { + const path = new Path(); + expect(typeof path.strokeAndFill).toBe('function'); + }); +});