0.1.6 • Published 1 year ago

@gurke/sqs v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@gurke/sqs

A collection of cucumber step definitions to help testing sqs configuration.

Prerequisite

  1. Using Jest as a test runner
  2. Using jest-cucumber library for cucumber setup

Features

Available step definitions:

given(/a (fifo|standard) queue with queue name variable "(.*)" exists/);

given(
  /the following batch of queue messages has been sent to queue with queue name variable "(.*)":/
);

then(/queue with variable name "(.*)" should have "(.*)" (message|messages)/);

then(
  /queue with variable name "(.*)" should have message with the following MessageBody and MessageAttributes/
);

then(
  /queue with variable name "(.*)" should have message with following message Body:/
);

Example usage

import { autoBindSteps, loadFeatures } from 'jest-cucumber';
import {
  sqsSteps,
  sqsCleanUp,
  waitForInFlightMessagesToBeVisible,
} from '@gurke/sqs';

const features = loadFeatures(/* Your feature file(s) */);

const steps = ({ when }) => {
  when(/amazing things happen/, async () => {
    // insert execution of your amazing event(s) / action(s)

    // remember to wait for the message to be visible in the last step of your when scenario
    await waitForInFlightMessagesToBeVisible();
  });
};

afterEach(async () => {
  await sqsCleanUp();
});

autoBindSteps(features, [sqsSteps, steps]);

With this setup, the available step definitions can be use in your feature file.

Default environment variables

The default value of the environment variables for AWS in this library are: |Variable Name|Value| | -------- | ---- | |AWS_REGION|eu-central-1| |TEST_SQS_ENDPOINT|http://eu-central-1.queue.localhost.localstack.cloud:4566| |TEST_AWS_ACCESS_KEY_ID|test| |TEST_AWS_SECRET_ACCESS_KEY|test|

If you need to pass a different value, you can configure it by overwriting it.

0.1.6

1 year ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago