1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
Sebastian Malton 2020-07-14 15:29:49 -04:00
parent 20ff8550df
commit a6bfd73de9
6 changed files with 18 additions and 10 deletions

View File

@ -13,7 +13,6 @@ describe("for an empty config", () => {
}
}
mockFs(mockOpts)
const userStore = UserStore.getInstance()
})
afterEach(() => {
@ -57,12 +56,10 @@ describe("migrations", () => {
'config.json': JSON.stringify({
user: { username: 'foobar' },
preferences: { colorTheme: 'light' },
lastSeenAppVersion: '1.2.3'
})
}
}
mockFs(mockOpts)
const userStore = UserStore.getInstance()
})
afterEach(() => {

View File

@ -1,5 +1,4 @@
import { CoreV1Api, KubeConfig } from "@kubernetes/client-node"
import http from "http"
import { ServerOptions } from "http-proxy"
import * as url from "url"
import logger from "./logger"

View File

@ -125,7 +125,7 @@ export class Kubectl {
}
try {
const { stdout, stderr } = await promiseExec(`"${this.path}" version --client=true -o json`)
const { stdout } = await promiseExec(`"${this.path}" version --client=true -o json`)
const output = JSON.parse(stdout)
let version: string = output.clientVersion.gitVersion
if (version[0] === 'v') {

View File

@ -1,5 +1,4 @@
import { formatDuration } from "../formatDuration";
import { min } from "moment";
const second = 1000;
const minute = 60 * second;
@ -44,4 +43,11 @@ describe("human format durations", () => {
const significant = formatDuration(31 * second, false);
expect(significant).toBe("31s");
});
test("zero duration should output something", () => {
const zero = formatDuration(0, false);
expect(zero).not.toHaveLength(0);
expect(zero).toBe("0s");
});
});

View File

@ -24,7 +24,7 @@ export function formatDuration(timeValue: number, compact: boolean) {
.map(([dur, suf]) => dur + suf);
if (compact) {
return meaningfulValues[0];
return meaningfulValues[0] || "0s";
}
return meaningfulValues.join(" ");

View File

@ -6,12 +6,11 @@
"target": "ES2017",
"module": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"importsNotUsedAsValues": "preserve",
"moduleResolution": "Node",
"sourceMap": true,
"strict": false,
"noImplicitAny": true,
"noUnusedLocals": false,
"noUnusedLocals": true,
"noImplicitReturns": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
@ -32,5 +31,12 @@
"compilerOptions": {
"module": "CommonJS"
}
}
},
"exclude": [
"node_modules",
"dist",
"coverage",
"dashboard",
"binaries"
]
}