import Enzyme from 'enzyme';
import React from 'react';

import { ConsentActionType } from '../../node_modules/@signatu/consent';
import { withDefaultTheme } from '../test/testUtil';
import { ConsentRequest } from './consentRequest';

const testComponent = (show: boolean = true, onClose = jest.fn()) => withDefaultTheme(<ConsentRequest
    config={{
        accessToken: "123", 
        apiKey: "123"
    }}
    subject="foo"
    issuer="bar"
    target="baz"
    type={ConsentActionType.BUTTONS}    
    >
</ConsentRequest>
)

test('Renders ConsentRequest element', async () => {
    const component = Enzyme.mount(testComponent())

    const title = component.find('[data-type="ConsentRequest"]')
    expect(title.length).toEqual(1)
    component.unmount()
})