2024-05-21 10:22:39 +00:00
|
|
|
/*\
|
|
|
|
title: test-plugins.js
|
|
|
|
type: application/javascript
|
|
|
|
tags: [[$:/tags/test-spec]]
|
|
|
|
|
|
|
|
Tests for integrity of the core plugins, languages, themes and editions
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
2024-05-21 10:26:24 +00:00
|
|
|
if($tw.node) {
|
|
|
|
|
|
|
|
describe("Plugin tests", function() {
|
|
|
|
|
|
|
|
// Get all the plugins as a hashmap by title of a JSON string with the plugin content
|
2024-05-23 15:28:08 +00:00
|
|
|
var tiddlers = $tw.utils.getAllPlugins({ignoreEnvironmentVariables: true});
|
2024-05-21 10:26:24 +00:00
|
|
|
// console.log(JSON.stringify(Object.keys(tiddlers),null,4));
|
|
|
|
describe("every plugin should have the required standard fields", function() {
|
|
|
|
var titles = Object.keys(tiddlers);
|
|
|
|
$tw.utils.each(titles,function(title) {
|
2024-05-29 14:06:33 +00:00
|
|
|
var fields = tiddlers[title];
|
|
|
|
it("plugin should have a recognised plugin-type field",function() {
|
|
|
|
expect(["plugin","language","theme"].indexOf(fields["plugin-type"]) !== -1).toEqual(true);
|
|
|
|
});
|
|
|
|
switch(fields["plugin-type"]) {
|
|
|
|
case "plugin":
|
|
|
|
it("plugin " + title + " should have name, description and list fields",function() {
|
|
|
|
expect(!!(fields.name && fields.description && fields.list)).toBe(true);
|
|
|
|
});
|
|
|
|
it("plugin " + title + " should have a valid stability field",function() {
|
|
|
|
expect(["STABILITY_0_DEPRECATED","STABILITY_1_EXPERIMENTAL","STABILITY_2_STABLE","STABILITY_3_LEGACY"].indexOf(fields.stability) !== -1).toBe(true);
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case "language":
|
|
|
|
it("language " + title + " should have name and description fields",function() {
|
2024-05-21 10:26:24 +00:00
|
|
|
expect(!!(fields.name && fields.description)).toEqual(true);
|
2024-05-29 14:06:33 +00:00
|
|
|
});
|
|
|
|
break;
|
|
|
|
case "theme":
|
|
|
|
it("theme " + title + " should have name and description fields",function() {
|
2024-05-21 10:26:24 +00:00
|
|
|
expect(!!(fields.name && fields.description)).toEqual(true);
|
2024-05-29 14:06:33 +00:00
|
|
|
});
|
|
|
|
break;
|
|
|
|
}
|
2024-05-21 10:22:39 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2024-05-21 10:26:24 +00:00
|
|
|
}
|
2024-05-21 10:22:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
})();
|