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

import { withDefaultTheme } from '../test/testUtil';
import { DataProcessingConsent } from './dataProcessingConsent';
import { PolicyDataProcessing, DataProcessingAction } from '@signatu/policy';

const defaultDP = new PolicyDataProcessing(DataProcessingAction.COLLECT, 'foo', 'bar')
const testComponent = (dp = defaultDP) => withDefaultTheme(<DataProcessingConsent
    config={{
        accessToken: "123", 
        apiKey: "123"
    }}
    dataprocessing={dp}
    subject="foo"
    issuer="bar"
    target="baz"    
/>)

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

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