---
# System prepended metadata

title: Untitled

---

```
const axios = require("axios");
const https = require('https');
const { DYNATRACE: { DYNATRACE_TOKEN, DYNATRACE_URL }} = require('@config');
const httpsAgent = new https.Agent({ rejectUnauthorized: false }); 

jest.mock('axios'); 

describe('metrics', () => {   
it('should return data on successful request', async () => {     
const mockData = { some: 'data' };     axios.get.mockResolvedValueOnce({ data: mockData });     const params = { some: 'params' };     

const result = await metrics(params);     expect(axios.get).toHaveBeenCalledWith(`${DYNATRACE_URL}/metrics/query?${new URLSearchParams(params).toString()}`, {       headers: { 'Authorization': `Api-Token ${DYNATRACE_TOKEN}`, httpsAgent }     });     expect(result).toEqual(mockData);  });
```