Fix tests

This commit is contained in:
Alexander Zobnin
2021-08-09 18:07:53 +03:00
parent 8499d726b2
commit 5de5c2b143

View File

@@ -257,16 +257,16 @@ describe('ZabbixDatasource', () => {
it('should return items', (done) => {
const tests = [
{ query: '*.*.*.*', expect: ['/.*/', '/.*/', '', '/.*/'] },
{ query: '.*.*.*', expect: ['', '/.*/', '', '/.*/'] },
{ query: 'Backend.backend01.*.*', expect: ['Backend', 'backend01', '', '/.*/'] },
{ query: 'Back*.*.cpu.*', expect: ['Back*', '/.*/', 'cpu', '/.*/'] }
{ query: '*.*.*.*', expect: ['/.*/', '/.*/', '', null, '/.*/'] },
{ query: '.*.*.*', expect: ['', '/.*/', '', null, '/.*/'] },
{ query: 'Backend.backend01.*.*', expect: ['Backend', 'backend01', '', null, '/.*/'] },
{ query: 'Back*.*.cpu.*', expect: ['Back*', '/.*/', 'cpu', null, '/.*/'] }
];
for (const test of tests) {
ctx.ds.metricFindQuery(test.query);
expect(ctx.ds.zabbix.getItems)
.toBeCalledWith(test.expect[0], test.expect[1], test.expect[2], test.expect[3]);
.toBeCalledWith(test.expect[0], test.expect[1], test.expect[2], test.expect[3], test.expect[4]);
ctx.ds.zabbix.getItems.mockClear();
}
done();