chore(plugin-logo): Added (esm) unit tests. See #408
This commit is contained in:
parent
8e5554cf53
commit
4a7249e23f
5 changed files with 39 additions and 18 deletions
|
@ -1,6 +1,12 @@
|
||||||
# Change log for: @freesewing/plugin-logo
|
# Change log for: @freesewing/plugin-logo
|
||||||
|
|
||||||
|
|
||||||
|
## unreleased (NaN-NaN-NaN)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added (esm) unit tests
|
||||||
|
|
||||||
## 2.15.0 (2021-04-15)
|
## 2.15.0 (2021-04-15)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -30,18 +30,23 @@
|
||||||
"clean": "rimraf dist",
|
"clean": "rimraf dist",
|
||||||
"build": "rollup -c",
|
"build": "rollup -c",
|
||||||
"lernabuild": "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",
|
"pubtest": "npm publish --registry http://localhost:6662",
|
||||||
"pubforce": "npm publish",
|
"pubforce": "npm publish",
|
||||||
"symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -",
|
"symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -",
|
||||||
"start": "rollup -c -w",
|
"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": {
|
"peerDependencies": {
|
||||||
"@freesewing/core": "^2.19.5"
|
"@freesewing/core": "^2.19.5"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {},
|
"devDependencies": {
|
||||||
|
"mocha": "^9.1.1",
|
||||||
|
"chai": "^4.2.0",
|
||||||
|
"@babel/register": "^7.10.5"
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist/*",
|
"dist/*",
|
||||||
"README.md",
|
"README.md",
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
import freesewing from '@freesewing/core'
|
|
||||||
import { version } from '../package.json'
|
|
||||||
|
|
||||||
const chai = require('chai')
|
|
||||||
const expect = chai.expect
|
|
||||||
const plugin = require('../dist/index.js')
|
|
||||||
|
|
||||||
it('Should set the plugin name:version attribute and import style and defs', () => {
|
|
||||||
const pattern = new freesewing.Pattern().use(plugin)
|
|
||||||
pattern.draft().render()
|
|
||||||
expect(pattern.svg.attributes.get('freesewing:plugin-logo')).to.equal(version)
|
|
||||||
expect(pattern.svg.defs).to.contain(
|
|
||||||
'<g id="logo" transform="translate(-23 -36)"><path class="logo"'
|
|
||||||
)
|
|
||||||
})
|
|
15
packages/plugin-logo/tests/plugin.test.mjs
Normal file
15
packages/plugin-logo/tests/plugin.test.mjs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import chai from 'chai'
|
||||||
|
import freesewing from '@freesewing/core'
|
||||||
|
import plugin from '../dist/index.mjs'
|
||||||
|
|
||||||
|
const expect = chai.expect
|
||||||
|
|
||||||
|
describe('Logo Plugin Tests', () => {
|
||||||
|
it('Should import style and defs', () => {
|
||||||
|
const pattern = new freesewing.Pattern().use(plugin)
|
||||||
|
pattern.draft().render()
|
||||||
|
expect(pattern.svg.defs).to.contain(
|
||||||
|
'<g id="logo" transform="translate(-23 -36)"><path class="logo"'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
10
packages/plugin-logo/tests/shared.test.mjs
Normal file
10
packages/plugin-logo/tests/shared.test.mjs
Normal file
|
@ -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)
|
Loading…
Add table
Add a link
Reference in a new issue