diff --git a/package.json b/package.json index 8398f6b..bf59a93 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "scripts": { "build:types": "tsc -p tsconfig.json --emitDeclarationOnly", "build": "rm -rf ./dist && npm run build:types && rollup -c", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "vitest" }, "devDependencies": { "@rollup/plugin-typescript": "^12.1.4", diff --git a/src/index.ts b/src/index.ts index fdc4eec..20d1651 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,7 +7,9 @@ export default class Updater { } async getArchive(): Promise { - const res = await fetch(`${this.archiveURL}.${this.feedType}`); + const res = await fetch(`${this.archiveURL}.${this.feedType}`, { + "mode": "cors" + }); console.log(res); } } diff --git a/test/archive.test.ts b/test/archive.test.ts new file mode 100644 index 0000000..6d4deb9 --- /dev/null +++ b/test/archive.test.ts @@ -0,0 +1,10 @@ +import { expect, test } from "vitest"; +import Updater from "../src/index.ts"; + +test("get archive from gitea", async (): Promise => { + 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); +});