diff --git a/packages/plugin-notches/CHANGELOG.md b/packages/plugin-notches/CHANGELOG.md index 4d6ac31b8b6..72796b69f99 100644 --- a/packages/plugin-notches/CHANGELOG.md +++ b/packages/plugin-notches/CHANGELOG.md @@ -1,6 +1,12 @@ # Change log for: @freesewing/plugin-notches +## unreleased (NaN-NaN-NaN) + +### Added + + - Added (esm) unit tests + ## 2.11.0 (2021-01-10) ### Added diff --git a/packages/plugin-notches/package.json b/packages/plugin-notches/package.json index ee17e471d20..8f3051f4945 100644 --- a/packages/plugin-notches/package.json +++ b/packages/plugin-notches/package.json @@ -30,18 +30,23 @@ "clean": "rimraf dist", "build": "rollup -c", "lernabuild": "rollup -c", - "test": "BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.js --require @babel/register", + "test": "BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.mjs --require @babel/register", "pubtest": "npm publish --registry http://localhost:6662", "pubforce": "npm publish", "symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -", "start": "rollup -c -w", - "prettier": "npx prettier --write 'src/*.js' 'tests/*.js'" + "testci": "BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.mjs --require @babel/register", + "prettier": "npx prettier --write 'src/*.js' 'tests/*.mjs'" }, "peerDependencies": { "@freesewing/core": "^2.19.5" }, "dependencies": {}, - "devDependencies": {}, + "devDependencies": { + "mocha": "^9.1.1", + "chai": "^4.2.0", + "@babel/register": "^7.10.5" + }, "files": [ "dist/*", "README.md", diff --git a/packages/plugin-notches/src/index.js b/packages/plugin-notches/src/index.js index 05fbb6762be..fa47ed06c8c 100644 --- a/packages/plugin-notches/src/index.js +++ b/packages/plugin-notches/src/index.js @@ -10,7 +10,7 @@ export default { preRender: function (svg) { if (svg.attributes.get('freesewing:plugin-notches') === false) { svg.defs += notches - svg.attributes.add('freesewing:plugin-notches', version) + svg.attributes.set('freesewing:plugin-notches', version) } }, }, diff --git a/packages/plugin-notches/tests/plugin.test.mjs b/packages/plugin-notches/tests/plugin.test.mjs new file mode 100644 index 00000000000..475b4d8bd22 --- /dev/null +++ b/packages/plugin-notches/tests/plugin.test.mjs @@ -0,0 +1,15 @@ +import chai from 'chai' +import freesewing from '@freesewing/core' +import plugin from '../dist/index.mjs' + +const expect = chai.expect + +const pattern = new freesewing.Pattern().use(plugin) +pattern.draft().render() + +describe('Notches Plugin Test', () => { + it(`Should add the snippets to defs`, () => { + expect(pattern.svg.defs).to.contain('') + }) +}) + diff --git a/packages/plugin-notches/tests/shared.test.mjs b/packages/plugin-notches/tests/shared.test.mjs new file mode 100644 index 00000000000..42cd98f4655 --- /dev/null +++ b/packages/plugin-notches/tests/shared.test.mjs @@ -0,0 +1,10 @@ +// This file is auto-generated. +// Changes you make will be overwritten. +import freesewing from '@freesewing/core' +import chai from 'chai' +import plugin from '../dist/index.mjs' +import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' + + +// Run shared tests +sharedPluginTests(plugin, freesewing, chai.expect)