From c9f105405f504ae16da0077588e455cef6ca354c Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Wed, 25 May 2022 16:02:43 +0300 Subject: [PATCH] appPublishDate initial test Signed-off-by: Alex Andreev --- .../__tests__/app-publish-date.test.ts | 20 +++++++++++++++++++ .../app-publish-date.injectable.ts | 6 ++++-- .../app-update-warning/app-publish-date.ts | 8 ++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 src/renderer/app-update-warning/__tests__/app-publish-date.test.ts create mode 100644 src/renderer/app-update-warning/app-publish-date.ts diff --git a/src/renderer/app-update-warning/__tests__/app-publish-date.test.ts b/src/renderer/app-update-warning/__tests__/app-publish-date.test.ts new file mode 100644 index 0000000000..6d6507f40d --- /dev/null +++ b/src/renderer/app-update-warning/__tests__/app-publish-date.test.ts @@ -0,0 +1,20 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ + +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", () => { + const 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(""); + }); +}); diff --git a/src/renderer/app-update-warning/app-publish-date.injectable.ts b/src/renderer/app-update-warning/app-publish-date.injectable.ts index 07fd3fccae..2b5ae34a4f 100644 --- a/src/renderer/app-update-warning/app-publish-date.injectable.ts +++ b/src/renderer/app-update-warning/app-publish-date.injectable.ts @@ -4,12 +4,14 @@ */ 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: () => { - return "Wed, 04 May 2022 02:35:00 +0300"; + instantiate: (di) => { + return appPublishDate(di.inject(appVersionInjectable)); }, }); diff --git a/src/renderer/app-update-warning/app-publish-date.ts b/src/renderer/app-update-warning/app-publish-date.ts new file mode 100644 index 0000000000..cd08d07a97 --- /dev/null +++ b/src/renderer/app-update-warning/app-publish-date.ts @@ -0,0 +1,8 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ + +export function appPublishDate(appVersion: string) { + return ""; +}