mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
22 lines
588 B
TypeScript
22 lines
588 B
TypeScript
import { cpuUnitsToNumber } from "../convertCpu";
|
|
|
|
jest.mock('../../api/index', () => 'apiKube');
|
|
jest.mock('../../config.store', () => 'configStore');
|
|
describe("k8s CPU units conversion", () => {
|
|
test("Convert normal, nano(n), micro(u), milli(m) units to cores number", () => {
|
|
const units = [
|
|
"0.5",
|
|
"100m", // 0.1
|
|
"930000n", // 0.00093
|
|
"3028u", // 0.003028
|
|
]
|
|
const cpuCores = units.map(unit => cpuUnitsToNumber(unit))
|
|
const expected = [
|
|
0.5,
|
|
0.1,
|
|
0.00093,
|
|
0.003028
|
|
]
|
|
expect(cpuCores).toEqual(expected)
|
|
});
|
|
}); |