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) => { it('should return items', (done) => {
const tests = [ const tests = [
{ query: '*.*.*.*', expect: ['/.*/', '/.*/', '', '/.*/'] }, { query: '*.*.*.*', expect: ['/.*/', '/.*/', '', null, '/.*/'] },
{ query: '.*.*.*', expect: ['', '/.*/', '', '/.*/'] }, { query: '.*.*.*', expect: ['', '/.*/', '', null, '/.*/'] },
{ query: 'Backend.backend01.*.*', expect: ['Backend', 'backend01', '', '/.*/'] }, { query: 'Backend.backend01.*.*', expect: ['Backend', 'backend01', '', null, '/.*/'] },
{ query: 'Back*.*.cpu.*', expect: ['Back*', '/.*/', 'cpu', '/.*/'] } { query: 'Back*.*.cpu.*', expect: ['Back*', '/.*/', 'cpu', null, '/.*/'] }
]; ];
for (const test of tests) { for (const test of tests) {
ctx.ds.metricFindQuery(test.query); ctx.ds.metricFindQuery(test.query);
expect(ctx.ds.zabbix.getItems) 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(); ctx.ds.zabbix.getItems.mockClear();
} }
done(); done();