2024-02-04 12:14:42 +01:00
|
|
|
import { expect } from 'chai'
|
|
|
|
|
2021-11-27 16:54:50 +01:00
|
|
|
/*
|
|
|
|
* This runs unit tests for the plugin configuration
|
|
|
|
* It expects the following:
|
|
|
|
*
|
|
|
|
* @param object plugin: The plugin object
|
|
|
|
*/
|
2024-02-04 12:14:42 +01:00
|
|
|
export const sharedPluginTests = (plugin) => {
|
2021-11-27 16:54:50 +01:00
|
|
|
describe('Shared Plugin Tests', () => {
|
|
|
|
it('Should have a name property', () => {
|
2024-02-04 12:14:42 +01:00
|
|
|
expect(typeof plugin.name).to.equal('string')
|
|
|
|
expect(plugin.name.length).to.be.greaterThan(2)
|
2021-11-27 16:54:50 +01:00
|
|
|
})
|
|
|
|
it('Should have a version property', () => {
|
2024-02-04 12:14:42 +01:00
|
|
|
expect(typeof plugin.version).to.equal('string')
|
|
|
|
expect(plugin.version.length).to.be.greaterThan(2)
|
2021-11-27 16:54:50 +01:00
|
|
|
})
|
|
|
|
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) {
|
2024-02-04 12:14:42 +01:00
|
|
|
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)
|
2021-11-27 16:54:50 +01:00
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|