{"size": 964, "ext": "js", "max_stars_repo_path": "test/core.js", "max_stars_repo_name": "AndrewBarber/hermes-node", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/core.js", "max_issues_repo_name": "AndrewBarber/hermes-node", "max_issues_repo_issues_event_min_datetime": "2022-02-13T01:31:57.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-13T01:31:57.000Z", "max_forks_repo_path": "test/core.js", "max_forks_repo_name": "AndrewBarber/hermes-node", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 34.4285714286, "max_line_length": 149, "alphanum_fraction": 0.6804979253}
/* eslint-disable no-undef */
const axios = require('axios');
const MockAdapter = require('axios-mock-adapter');
const { expect } = require('chai');
const core = require('../src/core');

describe('authorise', () => {
  it('Should call API and return response successfully', async () => {
    // Arrange
    const mock = new MockAdapter(axios);
    const data = {
      grant_type: 'client_credentials',
      client_id: 'jarvis',
      client_secret: '93aCdnu$M1mc61KhzzrrtXN9ob9a&6DvuL9&',
      audience: 'client-tracking-api',
    };
    const headers = {
      Authorization:
        'Basic UDIySFNva3BqWHBidmN4V1JKdG92T0FQR0NsVTM2SFU6VEdlOVVIUkJ2NmxKUml3WWZLLUU0YndSTnJHNmY3RDBWdDhCT0RoRFlWSWpJVERrMkZaZHNuTlVkYjdjXzNJMQ==',
    };
    mock.onPost('https://hermes-client-integration-prod.eu.auth0.com/oauth/token').reply(200, data, headers);
    // Act
    const response = await core.authorise();
    // Assert
    expect(response).to.equal(true);
  });
});
