-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into development_2.6
- Loading branch information
Showing
6 changed files
with
106 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
packages/grid_client/tests/modules/compute_capacity.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { ComputeCapacity } from "../../src"; | ||
|
||
let computeCapacity: ComputeCapacity; | ||
|
||
beforeEach(() => { | ||
computeCapacity = new ComputeCapacity(); | ||
}); | ||
describe("Compute Capacity module", () => { | ||
test("Compute Capacity instance is of type ComputeCapacity.", () => { | ||
expect(computeCapacity).toBeInstanceOf(ComputeCapacity); | ||
}); | ||
|
||
test("Min values for cpu & memory.", () => { | ||
const cpu = 0; | ||
const mem = 255 * 1024 ** 2; | ||
|
||
computeCapacity.cpu = cpu; | ||
computeCapacity.memory = mem; | ||
|
||
const result = () => computeCapacity.challenge(); | ||
|
||
expect(result).toThrow(); | ||
}); | ||
|
||
test("Max values for cpu & memory.", () => { | ||
const cpu = 33; | ||
const mem = 255 * 1024 ** 4; | ||
|
||
computeCapacity.cpu = cpu; | ||
computeCapacity.memory = mem; | ||
|
||
const result = () => computeCapacity.challenge(); | ||
|
||
expect(result).toThrow(); | ||
}); | ||
|
||
test("cpu & memory doesn't accept decimal values.", () => { | ||
const cpu = 1.5; | ||
const mem = 1.2; | ||
|
||
computeCapacity.cpu = cpu; | ||
computeCapacity.memory = mem; | ||
|
||
const result = () => computeCapacity.challenge(); | ||
|
||
expect(result).toThrow(); | ||
}); | ||
|
||
test("cpu & memory empty values.", () => { | ||
const result = () => computeCapacity.challenge(); | ||
|
||
expect(result).toThrow(); | ||
}); | ||
|
||
test("An error should be thrown if cpu & memory negative values.", () => { | ||
const negative_cpu = -1; | ||
const negative_mem = -1; | ||
|
||
computeCapacity.cpu = negative_cpu; | ||
computeCapacity.memory = negative_mem; | ||
|
||
const result = () => computeCapacity.challenge(); | ||
|
||
expect(result).toThrow(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters