@chatopera/store
Version:
Chatopera Store 是证书商店,快速接入代码实现软件的计费、发票、证书管理。https://store.chatopera.com
46 lines (43 loc) • 1.53 kB
JavaScript
const test = require("ava");
const Store = require("../index");
const debug = require("debug")("store:tests:index");
require('dotenv').config()
test.only("Test writeQuotaWd", async (t) => {
debug("STORE_PROVIDER %s", process.env["STORE_PROVIDER"]);
const store = new Store(process.env["SERVERINST_ID"],
process.env["SERVICE_NAME"],
process.env["STORE_PROVIDER"]);
let consumes = [1, -1, 1];
let resp = await store.writeQuotaWd(process.env["LICENSE_SHORTID"], consumes);
debug("Resp %s", JSON.stringify(resp, null, 2));
// {
// "rc": 0,
// "data": {
// "license": {
// "shortId": "L3N7x1806xx",
// "effectivedateend": "2023-11-16 00:00:00.0",
// "quotaeffectiveremaining": 2
// }
// }
// }
t.pass();
})
test("Test getLicenseQuotaInfo", async (t) => {
debug("STORE_PROVIDER %s", process.env["STORE_PROVIDER"]);
const store = new Store(process.env["SERVERINST_ID"],
process.env["SERVICE_NAME"],
process.env["STORE_PROVIDER"]);
let resp = await store.getLicenseQuotaInfo(process.env["LICENSE_SHORTID"]);
debug("Resp %s", JSON.stringify(resp, null, 2));
// {
// "rc": 0,
// "data": {
// "license": {
// "shortId": "L3N7x1806xx",
// "effectivedateend": "2023-11-16 00:00:00.0",
// "quotaeffectiveremaining": 2
// }
// }
// }
t.pass();
})