1
0
Fork 0
freesewing/tests/plugins/shared.mjs
joostdecock 26e282f5b7 fix: Fix tests after major chai upgrade
Note that the tests for Lumina are failing, but that's not related to
the chai upgrade, rather it seems these tests fail because of issues in
the design that we'll tackle later (it's a brand new design yet to be
released).
2024-02-04 12:14:42 +01:00

27 lines
934 B
JavaScript

import { expect } from 'chai'
/*
* This runs unit tests for the plugin configuration
* It expects the following:
*
* @param object plugin: The plugin object
*/
export const sharedPluginTests = (plugin) => {
describe('Shared Plugin Tests', () => {
it('Should have a name property', () => {
expect(typeof plugin.name).to.equal('string')
expect(plugin.name.length).to.be.greaterThan(2)
})
it('Should have a version property', () => {
expect(typeof plugin.version).to.equal('string')
expect(plugin.version.length).to.be.greaterThan(2)
})
it('Version should be a proper semantic version', () => {
const chunks = plugin.version.split('.')
if (chunks.length > 3) {
expect(plugin.version.split('.').length).to.equal(4)
expect(chunks[2]).to.contain.oneOf(['-alpha', '-beta', '-rc'])
} else expect(plugin.version.split('.').length).to.equal(3)
})
})
}