feat: add tests
This commit is contained in:
parent
c4a88df09f
commit
6a8c7da9c6
|
|
@ -37,7 +37,7 @@ async function startup({ id, version, resourceURI, rootURI }, reason) {
|
|||
`${rootURI}/chrome/content/scripts/__addonRef__.js`,
|
||||
ctx,
|
||||
);
|
||||
Zotero.__addonInstance__.hooks.onStartup();
|
||||
await Zotero.__addonInstance__.hooks.onStartup();
|
||||
}
|
||||
|
||||
function onMainWindowLoad({ window: win }) {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -17,7 +17,7 @@
|
|||
"build-dev": "tsc --noEmit && zotero-plugin build --dev && cd build/addon && zip -r ../zotero-better-notes-dev.xpi .",
|
||||
"release": "zotero-plugin release",
|
||||
"lint": "prettier --write . && eslint . --ext .ts --fix",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"test": "zotero-plugin test",
|
||||
"update-deps": "npm update --save"
|
||||
},
|
||||
"repository": {
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
"unist-util-visit": "^5.0.0",
|
||||
"unist-util-visit-parents": "^6.0.1",
|
||||
"yamljs": "^0.3.0",
|
||||
"zotero-plugin-toolkit": "^4.0.9"
|
||||
"zotero-plugin-toolkit": "file:../zotero-plugin-toolkit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
"replace-in-file": "^7.2.0",
|
||||
"typescript": "^5.3.3",
|
||||
"xslt3": "^2.6.0",
|
||||
"zotero-plugin-scaffold": "^0.1.6",
|
||||
"zotero-plugin-scaffold": "file:../zotero-plugin-scaffold",
|
||||
"zotero-types": "^3.0.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ class Addon {
|
|||
public data: {
|
||||
uid: string;
|
||||
alive: boolean;
|
||||
// Env type, see build.js
|
||||
env: "development" | "production";
|
||||
env: "development" | "production" | "test";
|
||||
ztoolkit: ZToolkit;
|
||||
// ztoolkit: ZoteroToolkit;
|
||||
locale?: {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
describe("Array", function () {
|
||||
it("should return -1 when the value is not present", function () {
|
||||
expect([1, 2, 3].indexOf(4)).to.equal(-1);
|
||||
});
|
||||
|
||||
it("should return the index when the value is present", function () {
|
||||
expect([1, 2, 3].indexOf(2)).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
describe("Zotero", function () {
|
||||
it("should have Zotero defined", function () {
|
||||
expect(Zotero).to.not.be.undefined;
|
||||
});
|
||||
});
|
||||
|
|
@ -64,6 +64,13 @@ export default defineConfig({
|
|||
all: true,
|
||||
},
|
||||
},
|
||||
test: {
|
||||
resourceDir: "test/",
|
||||
entries: ["test/"],
|
||||
prefs: {},
|
||||
abortOnFail: true,
|
||||
exitOnFinish: true,
|
||||
},
|
||||
|
||||
// If you need to see a more detailed build log, uncomment the following line:
|
||||
// logLevel: "trace",
|
||||
|
|
|
|||
Loading…
Reference in New Issue