2021-11-27 16:54:50 +01:00
|
|
|
import chai 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', () => {
|
|
|
|
chai.expect(typeof plugin.name).to.equal('string')
|
|
|
|
chai.expect(plugin.name.length).to.be.greaterThan(2)
|
|
|
|
})
|
|
|
|
it('Should have a version property', () => {
|
|
|
|
chai.expect(typeof plugin.version).to.equal('string')
|
|
|
|
chai.expect(plugin.version.length).to.be.greaterThan(2)
|
|
|
|
})
|
|
|
|
it('Version should be a proper semantic version', () => {
|
2022-02-19 08:24:33 +01:00
|
|
|
const chunks = plugin.version.split('.')
|
|
|
|
if (chunks.length > 3) {
|
|
|
|
chai.expect(plugin.version.split('.').length).to.equal(4)
|
2022-08-24 00:24:03 -04:00
|
|
|
chai.expect(chunks[2]).to.contain.oneOf(['-alpha', '-beta', '-rc'])
|
2022-02-19 08:24:33 +01:00
|
|
|
}
|
|
|
|
else chai.expect(plugin.version.split('.').length).to.equal(3)
|
2021-11-27 16:54:50 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|