the date retrieved is now correct
This commit is contained in:
@@ -31,7 +31,7 @@ export default class Updater {
|
|||||||
if (element.name == "title") {
|
if (element.name == "title") {
|
||||||
outEntry.title = (element.children[0] as XmlText).text;
|
outEntry.title = (element.children[0] as XmlText).text;
|
||||||
}
|
}
|
||||||
else if (element.name == "date") {
|
else if (element.name == "updated") {
|
||||||
outEntry.date = new Date((element.children[0] as XmlText).text);
|
outEntry.date = new Date((element.children[0] as XmlText).text);
|
||||||
}
|
}
|
||||||
else if (element.name == "link") {
|
else if (element.name == "link") {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { expect, expectTypeOf, test } from "vitest";
|
import { describe, expect, test } from "vitest";
|
||||||
import Updater from "../src/index.ts";
|
import Updater, { versionNotes } from "../src/index.ts";
|
||||||
|
|
||||||
|
describe("retrieving data", () => {
|
||||||
test("get an atom feed from gitea", async (): Promise<void> => {
|
test("get an atom feed from gitea", async (): Promise<void> => {
|
||||||
const updater = new Updater("https://git.emaker.limited/MicrocontrollerCD/SoftwareRelease/releases", "atom");
|
const updater = new Updater("https://git.emaker.limited/MicrocontrollerCD/SoftwareRelease/releases", "atom");
|
||||||
const res = await updater.getArchive();
|
const res = await updater.getArchive();
|
||||||
@@ -21,3 +22,14 @@ test("get an atom feed from github", async (): Promise<void> => {
|
|||||||
expect(res).not.toBe(null);
|
expect(res).not.toBe(null);
|
||||||
expect(res.length).toBeGreaterThan(0);
|
expect(res.length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("data validation", () => {
|
||||||
|
const updater = new Updater("https://git.emaker.limited/MicrocontrollerCD/SoftwareRelease/releases", "atom");
|
||||||
|
test("date checked is not current date", async () => {
|
||||||
|
const res: versionNotes[] = await updater.getArchive();
|
||||||
|
const date: Date = res[0].date as Date;
|
||||||
|
const today: Date = new Date;
|
||||||
|
expect(date.getUTCSeconds()).not.toBe(today.getUTCSeconds())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user