forked from mtusi2026/mtusi2026lab6
35 lines
3.1 KiB
Plaintext
35 lines
3.1 KiB
Plaintext
bun test v1.4.4 (38afee6c8)
|
|
|
|
student-tests/grafana-provisioning.test.ts:
|
|
(pass) accepts the actual configured dashboard and exact rule UID set [0.05ms]
|
|
1 | import{test,expect}from'bun:test';import{dashboardMatches,rulesMatch}from'../scripts/lib/grafana-provisioning';
|
|
2 | const expected={uid:'messenger',panels:[{id:1,title:'RPS'},{id:2,title:'API p95'}]};
|
|
3 | test('accepts the actual configured dashboard and exact rule UID set',()=>{expect(dashboardMatches({dashboard:expected},expected)).toBe(true);expect(rulesMatch([{uid:'b'},{uid:'a'}],['a','b'])).toBe(true)});
|
|
4 | test('rejects empty or mismatched dashboard payload despite successful HTTP status',()=>{expect(dashboardMatches({},expected)).toBe(false);expect(dashboardMatches({dashboard:{uid:'other',panels:expected.panels}},expected)).toBe(false);expect(dashboardMatches({dashboard:{...expected,panels:[]}},expected)).toBe(false);expect(dashboardMatches({dashboard:{...expected,panels:[expected.panels[0],expected.panels[0]]}},expected)).toBe(false);expect(dashboardMatches({dashboard:{...expected,panels:[expected.panels[0],{id:2,title:'Wrong signal'}]}},expected)).toBe(false)});
|
|
|
|
error: expect(received).toBe(expected)
|
|
|
|
Expected: false
|
|
Received: true
|
|
|
|
at <anonymous> (/Users/rey/mtuci/vp/lab6/student-tests/grafana-provisioning.test.ts:4:128)
|
|
(fail) rejects empty or mismatched dashboard payload despite successful HTTP status [0.14ms]
|
|
1 | import{test,expect}from'bun:test';import{dashboardMatches,rulesMatch}from'../scripts/lib/grafana-provisioning';
|
|
2 | const expected={uid:'messenger',panels:[{id:1,title:'RPS'},{id:2,title:'API p95'}]};
|
|
3 | test('accepts the actual configured dashboard and exact rule UID set',()=>{expect(dashboardMatches({dashboard:expected},expected)).toBe(true);expect(rulesMatch([{uid:'b'},{uid:'a'}],['a','b'])).toBe(true)});
|
|
4 | test('rejects empty or mismatched dashboard payload despite successful HTTP status',()=>{expect(dashboardMatches({},expected)).toBe(false);expect(dashboardMatches({dashboard:{uid:'other',panels:expected.panels}},expected)).toBe(false);expect(dashboardMatches({dashboard:{...expected,panels:[]}},expected)).toBe(false);expect(dashboardMatches({dashboard:{...expected,panels:[expected.panels[0],expected.panels[0]]}},expected)).toBe(false);expect(dashboardMatches({dashboard:{...expected,panels:[expected.panels[0],{id:2,title:'Wrong signal'}]}},expected)).toBe(false)});
|
|
5 | test('rejects absent, duplicated or wrong rule UIDs even when counts match',()=>{expect(rulesMatch([],['a','b'])).toBe(false);expect(rulesMatch([{uid:'a'},{uid:'a'}],['a','b'])).toBe(false);expect(rulesMatch([{uid:'a'},{uid:'c'}],['a','b'])).toBe(false);expect(rulesMatch([],[])).toBe(false)});
|
|
^
|
|
error: expect(received).toBe(expected)
|
|
|
|
Expected: false
|
|
Received: true
|
|
|
|
at <anonymous> (/Users/rey/mtuci/vp/lab6/student-tests/grafana-provisioning.test.ts:5:115)
|
|
(fail) rejects absent, duplicated or wrong rule UIDs even when counts match [0.04ms]
|
|
|
|
1 pass
|
|
2 fail
|
|
4 expect() calls
|
|
Ran 3 tests across 1 file. [10.00ms]
|