@certd/plugin-cert 1.34.5 → 1.34.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/plugin/cert-plugin/base.d.ts +1 -0
- package/dist/plugin/cert-plugin/base.js +8 -3
- package/dist/plugin/cert-plugin/cert-reader.d.ts +4 -0
- package/dist/plugin/cert-plugin/cert-reader.js +19 -2
- package/dist/plugin/cert-plugin/index.js +2 -2
- package/dist/plugin/cert-plugin/lego/index.d.ts +1 -0
- package/dist/plugin/cert-plugin/lego/index.js +4 -1
- package/package.json +6 -6
- package/stats.html +6177 -0
- package/test/cert-plugin.test.mjs +27 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { CertApplyPlugin } from "../dist/index.js";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
import { logger } from "@certd/basic";
|
|
5
|
+
|
|
6
|
+
describe("test/cert-plugin.ts", () => {
|
|
7
|
+
const certApplyPlugin = new CertApplyPlugin();
|
|
8
|
+
certApplyPlugin.logger = logger;
|
|
9
|
+
it("should throw error when expires is null or undefined", () => {
|
|
10
|
+
expect(() => {
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
certApplyPlugin.isWillExpire(undefined);
|
|
13
|
+
}).throw("过期时间不能为空");
|
|
14
|
+
|
|
15
|
+
expect(() => {
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
certApplyPlugin.isWillExpire(null);
|
|
18
|
+
}).throw("过期时间不能为空");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("isWillExpire", () => {
|
|
22
|
+
const now = dayjs().add(36, "day") - 10000;
|
|
23
|
+
const res = certApplyPlugin.isWillExpire(now.valueOf(), 35);
|
|
24
|
+
console.log(res);
|
|
25
|
+
expect(res.isWillExpire).eq(true);
|
|
26
|
+
});
|
|
27
|
+
});
|