add tests
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
|
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
|
||||||
"build": "rm -rf ./dist && npm run build:types && rollup -c",
|
"build": "rm -rf ./dist && npm run build:types && rollup -c",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-typescript": "^12.1.4",
|
"@rollup/plugin-typescript": "^12.1.4",
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ export default class Updater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getArchive(): Promise<void> {
|
async getArchive(): Promise<void> {
|
||||||
const res = await fetch(`${this.archiveURL}.${this.feedType}`);
|
const res = await fetch(`${this.archiveURL}.${this.feedType}`, {
|
||||||
|
"mode": "cors"
|
||||||
|
});
|
||||||
console.log(res);
|
console.log(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
test/archive.test.ts
Normal file
10
test/archive.test.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { expect, test } from "vitest";
|
||||||
|
import Updater from "../src/index.ts";
|
||||||
|
|
||||||
|
test("get archive from gitea", async (): Promise<void> => {
|
||||||
|
const updater = new Updater("https://git.emaker.limited/MicrocontrollerCD/SoftwareRelease/releases");
|
||||||
|
const res = await updater.getArchive();
|
||||||
|
const text = res.text();
|
||||||
|
console.log(text);
|
||||||
|
expect(res).not.toBe(null);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user