{%- import "cloudevents.jinja.include" as cloudEvents -%}
{%- import "util.jinja.include" as util -%}
// This code was generated by the xRegistry tool.
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.

import * as rhea from 'rhea';
{%- set messagegroups = root.messagegroups %}
{%- set uses_cloudevents_message = cloudEvents.usesCloudEvents(root) %}

import * as {{ data_project_name }} from '../../{{ data_project_name }}/dist/index.js';
import { {% for messagegroupid, messagegroup in messagegroups.items() -%}{%- set class_name = (messagegroupid | pascal | strip_namespace) + "Producer" %}{{ class_name }}{% if not loop.last %}, {% endif %}{% endfor %} } from '../src';
{%- if uses_cloudevents_message %}
import { CloudEvent } from 'cloudevents';
{%- endif %}

const AMQP_HOST = process.env.AMQP_HOST || 'localhost';
const AMQP_PORT = parseInt(process.env.AMQP_PORT || '5672');
const AMQP_ADDRESS = 'test-queue';

jest.setTimeout(10000);

{%- for messagegroupid, messagegroup in messagegroups.items() %}
{%- set pascal_group_name = messagegroupid | pascal %}
{%- set class_name = (pascal_group_name | strip_namespace) + "Producer" %}
{%- set test_class_name = (project_name | strip_dots | pascal) + (pascal_group_name | strip_dots) + "Tests" %}

describe('{{ test_class_name }}', () => {
    // Tests verify producer instantiation and method availability
    // For full integration testing with AMQP broker, configure AMQP_HOST and AMQP_PORT environment variables
    
    {%- set message_list = messagegroup.messages.items() | list %}
    {%- for messageid, message in message_list[:3] %}
    {%- set messagename = messageid | strip_namespace | pascal %}
    {%- set body_type = util.body_type(data_project_name, root, message) %}
    
    test('should have {{ messagename }} producer class with send methods', () => {
        // Verify producer class exists and has required methods
        expect({{ class_name }}).toBeDefined();
        expect({{ class_name }}.prototype.send{{ messagename }}).toBeDefined();
        expect({{ class_name }}.prototype.send{{ messagename }}Batch).toBeDefined();
        expect({{ class_name }}.prototype.close).toBeDefined();
    });
    {%- endfor %}
});
{%- endfor %}
