mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
refactor: plugins
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { FileStorage } from "@certd/pipeline/src/core/storage";
|
||||
import { ContextFactory } from "@certd/pipeline/src/core/context";
|
||||
import { AccessServiceTest } from "@certd/pipeline/test/pipeline/access-service-test";
|
||||
import { logger } from "@certd/pipeline";
|
||||
import { request } from "@certd/pipeline/src/utils/util.request";
|
||||
|
||||
const contextFactory = new ContextFactory(new FileStorage());
|
||||
|
||||
const userContext = contextFactory.getContext("user", "test");
|
||||
const pipelineContext = contextFactory.getContext("pipeline", "test");
|
||||
export const pluginInitProps = {
|
||||
accessService: new AccessServiceTest(),
|
||||
pipelineContext: pipelineContext,
|
||||
userContext: userContext,
|
||||
logger: logger,
|
||||
http: request,
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
import { expect } from "chai";
|
||||
import "mocha";
|
||||
import { pluginInitProps } from "../init.test";
|
||||
import { CertApplyPlugin } from "../../../src";
|
||||
describe("CertApply", function () {
|
||||
it("#execute", async function () {
|
||||
this.timeout(120000);
|
||||
const plugin = new CertApplyPlugin();
|
||||
// @ts-ignore
|
||||
delete plugin.define;
|
||||
await plugin.doInit(pluginInitProps);
|
||||
const output = await plugin.execute({
|
||||
domains: ["*.docmirror.cn", "docmirror.cn"],
|
||||
email: "xiaojunnuo@qq.com",
|
||||
dnsProviderType: "aliyun",
|
||||
accessId: "111",
|
||||
forceUpdate: true,
|
||||
});
|
||||
const cert = output.cert;
|
||||
expect(plugin.getDefine().name).eq("CertApply");
|
||||
expect(cert.crt != null).eq(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user