/* eslint-env node, mocha */
const assert = require('assert');
const { AuthlessClient, AuthlessLowLevelClient } = require('../src');
const { AuthlessRouter } = require('@authless/router');
const { AuthlessServiceDefault } = require('@authless/service-default');

const authlessDefault = new AuthlessServiceDefault();

describe('AuthlessClient', () => {
  let authlessClient, authlessLowLevelClient;
  before(() => {
    authlessLowLevelClient = new AuthlessLowLevelClient({
      retries: 0,
      uri: 'http://example.com:4000',
    });
  });

  describe('new', () => {
    it('returns authlessClient instance', () => {
      authlessClient = new AuthlessClient({
        lowLevelClient: authlessLowLevelClient,
        retries: 1,
        router: new AuthlessRouter([...authlessDefault.getRoutes()])
      });
      assert.equal(authlessClient instanceof AuthlessClient, true);
    });
  });
});
