mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove unused app-publish-date files
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
1bd4c46ed2
commit
64683a8a86
@ -1,49 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import appVersionInjectable from "../../../common/get-configuration-file-model/app-version/app-version.injectable";
|
||||
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
|
||||
import appPublishDateInjectable from "../app-publish-date.injectable";
|
||||
|
||||
describe("appPublishDate", () => {
|
||||
let di: DiContainer;
|
||||
|
||||
beforeEach(() => {
|
||||
di = getDiForUnitTesting({ doGeneralOverrides: true });
|
||||
});
|
||||
|
||||
it("should return empty string if appVersion is not provided", () => {
|
||||
di.override(appVersionInjectable, () => "");
|
||||
|
||||
const appPublishDate = di.inject(appPublishDateInjectable);
|
||||
|
||||
expect(appPublishDate).toBe("");
|
||||
});
|
||||
|
||||
it("should return empty string if version without date provided", () => {
|
||||
di.override(appVersionInjectable, () => "5.6.0-alpha.0");
|
||||
|
||||
const appPublishDate = di.inject(appPublishDateInjectable);
|
||||
|
||||
expect(appPublishDate).toBe("");
|
||||
});
|
||||
|
||||
it("should return empty string if invalid version date provided", () => {
|
||||
di.override(appVersionInjectable, () => "5.6.0-alpha.2021-23-1.0");
|
||||
|
||||
const appPublishDate = di.inject(appPublishDateInjectable);
|
||||
|
||||
expect(appPublishDate).toBe("");
|
||||
});
|
||||
|
||||
it("should return proper date if version with date provided", () => {
|
||||
di.override(appVersionInjectable, () => "5.4.6-latest.20220428.1");
|
||||
|
||||
const appPublishDate = di.inject(appPublishDateInjectable);
|
||||
|
||||
expect(appPublishDate).toBe("2022-04-28");
|
||||
});
|
||||
});
|
||||
@ -1,18 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import appVersionInjectable from "../../common/get-configuration-file-model/app-version/app-version.injectable";
|
||||
import { appPublishDate } from "./app-publish-date";
|
||||
|
||||
const appPublishDateInjectable = getInjectable({
|
||||
id: "app-publish-date",
|
||||
|
||||
instantiate: (di) => {
|
||||
return appPublishDate(di.inject(appVersionInjectable));
|
||||
},
|
||||
});
|
||||
|
||||
export default appPublishDateInjectable;
|
||||
@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import moment from "moment";
|
||||
|
||||
export function appPublishDate(appVersion = "") {
|
||||
const dateFromVersion = appVersion.match(/\d{8}/);
|
||||
const date = moment(dateFromVersion?.[0], "YYYYMMDD");
|
||||
|
||||
if (!date.isValid()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return date.format("YYYY-MM-DD");
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user