1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-10-30 06:36:17 +00:00
TiddlyWiki5/editions/test/tiddlers/tests/test-plugins.js

45 lines
1.3 KiB
JavaScript
Raw Normal View History

/*\
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";
describe("Plugin tests", function() {
// Get all the plugins as a hashmap by title of a JSON string with the plugin content
var tiddlers = $tw.utils.getAllPlugins();
// 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) {
it("plugin " + title + " should have the required standard fields",function() {
var fields = tiddlers[title];
expect(fields["plugin-type"]).toMatch(/^(?:plugin|language|theme)$/);
switch(fields["plugin-type"]) {
case "plugin":
expect(!!(fields.name && fields.description && fields.list)).toEqual(true);
expect(fields.stability).toMatch(/^(?:STABILITY_0_DEPRECATED|STABILITY_1_EXPERIMENTAL|STABILITY_2_STABLE|STABILITY_3_LEGACY)$/);
break;
case "language":
expect(!!(fields.name && fields.description)).toEqual(true);
break;
case "theme":
expect(!!(fields.name && fields.description)).toEqual(true);
break;
}
});
});
});
});
})();