Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fake-sqs

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fake-sqs

Run a fake SQS HTTP server for testing purposes

  • 5.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-85.71%
Maintainers
3
Weekly downloads
 
Created
Source

fake-sqs

Runs a fake SQS server on a HTTP port.

Example

const assert = require('assert')
const SQSServer = require('fake-sqs')
const AWS = require('aws-sdk')

async function test() {
  const myServer = new SQSServer({
    port: 0
  })

  await myServer.bootstrap()

  const sqs = new AWS.SQS({
    region: 'us-east-1',
    sslEnabled: false,
    accessKeyId: '123',
    secretAccessKey: 'abc',
    apiVersion: '2012-11-05'
  })
  const queueUrl = `http://` + myServer.hostPort

  await sqs.sendMessage({
    QueueURL: queueUrl,
    MessageBody: 'my message'
  }).promise()

  await myServer.waitForMessages(1)

  var queue = myServer.getQueue()

  assert.equal(queue[0].MessageBody, 'my message')
  assert.equal(queue.length, 1)

  await myServer.close()
}

process.on('unhandledReject', (err) => { throw err })
test()

Docs :

const server = new SQSServer(opts)

Create a fake SQS server

  • opts.port ; defaults to 0

await server.bootstrap()

Starts the server.

After bootstrap returns you can read server.hostPort to get the actual listening port of the server.

server.getQueue()

Returns the current array of items queued in SQS. These are shaped like aws SQS objects.

await server.waitForMessages(count)

Get notified once N messages have in total been sent to this fake SQS.

await server.waitForDeletes(count)

Get notified once N messages have in total been deleted from this fake SQS.

await server.waitForFlush()

Get notified when the number of pending messages in the SQS queue is zero.

This can be used with waitForMessages() to first wait for N messages to be send and then wait for them to have been received and deleted from the queue.

await server.close()

Closes the underlying http server.

install

% npm install fake-sqs

FAQs

Package last updated on 02 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc