import { makeId } from "@event-inc/utils";
import { createClient } from "../client";
import { createLinkToken } from "../logic";

require('dotenv').config();
jest.setTimeout(30000);

describe('Link APIs Specs', () => {
    it('Should create a Link token', async () => {
        const client = createClient(
            process.env.BUILDABLE_SECRET_KEY,
            {
                baseUrl: process.env.EVENT_INC_API_BASE_URL
            }
        );
        const linkToken = await createLinkToken(client, {
            connectionType: "source",
            type: "stripe",
            group: `my-stripe-source-${makeId(4)}`,
            label: `My Stripe Source ${makeId(4)}`,
            ttl: 24 * 60 * 60 * 1000,
        });

        expect(linkToken).toHaveProperty('token');

    });
});