mirror of
https://github.com/certd/certd.git
synced 2026-05-16 13:17:29 +08:00
chore: 补充单元测试
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
"build3": "rollup -c",
|
||||
"preview": "vite preview",
|
||||
"test": "mocha --loader=ts-node/esm",
|
||||
"test:unit": "mocha --no-config --node-option no-warnings --node-option loader=ts-node/esm \"src/**/*.test.ts\"",
|
||||
"pub": "npm publish",
|
||||
"compile": "tsc --skipLibCheck --watch"
|
||||
},
|
||||
@@ -42,6 +43,7 @@
|
||||
"mocha": "^10.2.0",
|
||||
"prettier": "^2.8.8",
|
||||
"rimraf": "^5.0.5",
|
||||
"ts-node": "^10.9.2",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference types="mocha" />
|
||||
|
||||
import { expect } from "chai";
|
||||
|
||||
import { PluginGroup, pluginGroups } from "./group.js";
|
||||
|
||||
describe("PluginGroup", () => {
|
||||
it("initializes a group with defaults", () => {
|
||||
const group = new PluginGroup("custom", "Custom");
|
||||
|
||||
expect(group.key).to.equal("custom");
|
||||
expect(group.title).to.equal("Custom");
|
||||
expect(group.order).to.equal(0);
|
||||
expect(group.icon).to.equal("");
|
||||
expect(group.plugins).to.deep.equal([]);
|
||||
});
|
||||
|
||||
it("exposes built-in groups with stable keys", () => {
|
||||
expect(pluginGroups.cert.key).to.equal("cert");
|
||||
expect(pluginGroups.host.key).to.equal("host");
|
||||
expect(pluginGroups.other.order).to.equal(10);
|
||||
});
|
||||
});
|
||||
@@ -7,7 +7,7 @@
|
||||
"esModuleInterop": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"inlineSourceMap":false,
|
||||
"inlineSourceMap": false,
|
||||
"sourceMap": false,
|
||||
"noImplicitThis": true,
|
||||
"noUnusedLocals": true,
|
||||
@@ -22,22 +22,11 @@
|
||||
"composite": false,
|
||||
"useDefineForClassFields": true,
|
||||
"strict": true,
|
||||
// "sourceMap": true,
|
||||
// "sourceMap": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": false,
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"lib": ["ESNext", "DOM"]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.json"
|
||||
],
|
||||
"exclude": [
|
||||
"*.js",
|
||||
"*.ts",
|
||||
"*.spec.ts",
|
||||
"dist",
|
||||
"node_modules",
|
||||
"test"
|
||||
],
|
||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.json"],
|
||||
"exclude": ["*.js", "*.ts", "*.spec.ts", "dist", "node_modules", "src/**/*.test.ts", "test"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user