Skip to content

Commit 40e824d

Browse files
- chore: Remove env variable while 'SKIP_PROPS_VALIDATION' while test
- feat: Add throw expectation while setting cpu/memory in ComputeCapacity
1 parent d7f02ef commit 40e824d

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

.github/workflows/grid_client_tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
RMB_PROXY: true
2424
STORE_SECRET: secret
2525
MNEMONIC: ${{ secrets.MNEMONIC }}
26-
SKIP_PROPS_VALIDATION: true
2726
steps:
2827
- name: set network for Schedule
2928
if: ${{env.NETWORK}} == ""

packages/grid_client/tests/modules/compute_capacity.test.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,38 @@ describe("Compute Capacity module", () => {
1515
const cpu = 0;
1616
const mem = 255 * 1024 ** 2;
1717

18-
computeCapacity.cpu = cpu;
19-
computeCapacity.memory = mem;
20-
18+
const setCPU = () => (computeCapacity.cpu = cpu);
19+
const setMem = () => (computeCapacity.memory = mem);
2120
const result = () => computeCapacity.challenge();
2221

22+
expect(setCPU).toThrow();
23+
expect(setMem).toThrow();
2324
expect(result).toThrow();
2425
});
2526

2627
test("Max values for cpu & memory.", () => {
2728
const cpu = 33;
2829
const mem = 255 * 1024 ** 4;
2930

30-
computeCapacity.cpu = cpu;
31-
computeCapacity.memory = mem;
32-
31+
const setCPU = () => (computeCapacity.cpu = cpu);
32+
const setMem = () => (computeCapacity.memory = mem);
3333
const result = () => computeCapacity.challenge();
3434

35+
expect(setCPU).toThrow();
36+
expect(setMem).toThrow();
3537
expect(result).toThrow();
3638
});
3739

3840
test("cpu & memory doesn't accept decimal values.", () => {
3941
const cpu = 1.5;
4042
const mem = 1.2;
4143

42-
computeCapacity.cpu = cpu;
43-
computeCapacity.memory = mem;
44-
44+
const setCPU = () => (computeCapacity.cpu = cpu);
45+
const setMem = () => (computeCapacity.memory = mem);
4546
const result = () => computeCapacity.challenge();
4647

48+
expect(setCPU).toThrow();
49+
expect(setMem).toThrow();
4750
expect(result).toThrow();
4851
});
4952

@@ -57,11 +60,12 @@ describe("Compute Capacity module", () => {
5760
const negative_cpu = -1;
5861
const negative_mem = -1;
5962

60-
computeCapacity.cpu = negative_cpu;
61-
computeCapacity.memory = negative_mem;
62-
63+
const setCPU = () => (computeCapacity.cpu = negative_cpu);
64+
const setMem = () => (computeCapacity.memory = negative_mem);
6365
const result = () => computeCapacity.challenge();
6466

67+
expect(setCPU).toThrow();
68+
expect(setMem).toThrow();
6569
expect(result).toThrow();
6670
});
6771
});

0 commit comments

Comments
 (0)