Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor (
@inject(BUS_SYMBOLS.Bus) private readonly bus: Bus
) {
super()
}
container.load(new LoggerModule())
container.load(new BusModule())
container.load(new BusWorkflowModule())
logger = Mock.ofType()
container.rebind(LOGGER_SYMBOLS.Logger).toConstantValue(logger.object)
persistence = container.get(BUS_WORKFLOW_SYMBOLS.Persistence)
const workflowRegistry = container.get(BUS_WORKFLOW_SYMBOLS.WorkflowRegistry)
workflowRegistry.register(TestWorkflowMisconfigured, TestWorkflowMisconfiguredData)
await workflowRegistry.initializeWorkflows()
bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)
await bootstrap.initialize(container)
bus = container.get(BUS_SYMBOLS.Bus)
await bus.send(command)
await sleep(CONSUME_TIMEOUT)
})
async function runDemo (): Promise {
const bus = container.get(BUS_SYMBOLS.Bus)
await bus.send(new StartSirenTest(generateUuid()))
}
c => ({
bus: c.get(BUS_SYMBOLS.Bus),
logger: c.get(LOGGER_SYMBOLS.Logger)
})
)
beforeAll(async () => {
container = new TestContainer()
container.bind(BUS_RABBITMQ_SYMBOLS.TransportConfiguration).toConstantValue(configuration)
bus = container.get(BUS_SYMBOLS.Bus)
sut = container.get(BUS_SYMBOLS.Transport)
bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)
bootstrap.registerHandler(TestCommandHandler)
const connectionFactory = container.get<() => Promise>(BUS_RABBITMQ_INTERNAL_SYMBOLS.AmqpFactory)
connection = await connectionFactory()
channel = await connection.createChannel()
await bootstrap.initialize(container)
})
beforeAll(async () => {
container = new TestContainer()
container.bind(BUS_POSTGRES_SYMBOLS.PostgresConfiguration).toConstantValue(configuration)
bus = container.get(BUS_SYMBOLS.Bus)
sut = container.get(BUS_WORKFLOW_SYMBOLS.Persistence)
postgres = container.get(BUS_POSTGRES_INTERNAL_SYMBOLS.PostgresPool)
workflows = container.get(BUS_WORKFLOW_SYMBOLS.WorkflowRegistry)
workflows.register(TestWorkflow, TestWorkflowData)
await workflows.initializeWorkflows()
bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)
await bootstrap.initialize(container)
})
container = new Container()
container.load(new LoggerModule())
container.load(new BusModule())
container.load(new BusWorkflowModule())
container.rebind(LOGGER_SYMBOLS.Logger).toConstantValue(Mock.ofType().object)
persistence = container.get(BUS_WORKFLOW_SYMBOLS.Persistence)
const workflowRegistry = container.get(BUS_WORKFLOW_SYMBOLS.WorkflowRegistry)
await workflowRegistry.registerFunctional(assignmentWorkflow)
await workflowRegistry.initializeWorkflows()
bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)
await bootstrap.initialize(container)
bus = container.get(BUS_SYMBOLS.Bus)
await bus.send(event)
await sleep(CONSUME_TIMEOUT)
})
beforeAll(async () => {
container = new TestContainer()
container.bind(BUS_SQS_SYMBOLS.SqsConfiguration).toConstantValue(sqsConfiguration)
sut = container.get(BUS_SYMBOLS.Transport)
sqs = container.get(BUS_SQS_INTERNAL_SYMBOLS.Sqs)
sns = container.get(BUS_SQS_INTERNAL_SYMBOLS.Sns)
bus = container.get(BUS_SYMBOLS.Bus)
bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)
handleChecker = Mock.ofType()
container.bind(HANDLE_CHECKER).toConstantValue(handleChecker.object)
bootstrap.registerHandler(TestCommandHandler)
})
container.load(new BusModule())
container.load(new BusWorkflowModule())
container.rebind(LOGGER_SYMBOLS.Logger).toConstantValue(Mock.ofType().object)
persistence = container.get(BUS_WORKFLOW_SYMBOLS.Persistence)
const workflowRegistry = container.get(BUS_WORKFLOW_SYMBOLS.WorkflowRegistry)
workflowRegistry.register(TestWorkflow, TestWorkflowData)
workflowRegistry.register(TestWorkflowStartedByCompletes, TestWorkflowStartedByCompletesData)
workflowRegistry.register(TestWorkflowStartedByDiscard, TestWorkflowStartedByDiscardData)
await workflowRegistry.initializeWorkflows()
bootstrap = container.get(BUS_SYMBOLS.ApplicationBootstrap)
await bootstrap.initialize(container)
bus = container.get(BUS_SYMBOLS.Bus)
await bus.send(command)
await sleep(CONSUME_TIMEOUT)
})