import { ProtegeEngineSDK } from './ProtegeEngineSDK';
import { ApiKeyAuth } from './auth';

describe('ProtegeEngineSDK', () => {
    const endpoint = 'https://example.com/graphql';
    const apiKey = 'my-api-key';
    const auth = new ApiKeyAuth(apiKey);
    const sdk = new ProtegeEngineSDK({ endpoint, auth });

    describe('constructor', () => {
        it('should throw an error if no API key is provided', () => {
            // @ts-ignore
            expect(() => new ProtegeEngineSDK({ endpoint })).toThrow('No API key provided');
        });

        it('should throw an error if no endpoint is provided', () => {
            // @ts-ignore
            expect(() => new ProtegeEngineSDK({ auth })).toThrow('No endpoint provided');
        });

        it('should create a new GraphQL client', () => {
            expect(sdk['client']).toBeDefined();
        });

        it('should create a new UserFunctions instance', () => {
            expect(sdk.user).toBeDefined();
        });

        it('should create a new InferenceBackendFunctions instance', () => {
            expect(sdk.inferenceBackend).toBeDefined();
        });

        it('should create a new PredictionFunctions instance', () => {
            expect(sdk.prediction).toBeDefined();
        });

        it('should create a new LabelFunctions instance', () => {
            expect(sdk.label).toBeDefined();
        });

        it('should create a new FeedbackFunctions instance', () => {
            expect(sdk.feedback).toBeDefined();
        });

        it('should create a new DatasetFunctions instance', () => {
            expect(sdk.dataset).toBeDefined();
        });
    });
});