# ask-assertions

> A set of helpers to test ask projects.

Latest version **1.1.0** (published 2019-05-01) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install ask-assertions
pnpm add ask-assertions
yarn add ask-assertions
bun add ask-assertions
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-05-01 |
| First published | 2019-02-27 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | David Hunt |
| Maintainers | davidhunt |
| Keywords | Alexa, ASK, assert, assertions, test |

## Links

- npm: https://www.npmjs.com/package/ask-assertions
- Repository: https://github.com/davidpaulhunt/ask-assertions
- Homepage: https://github.com/davidpaulhunt/ask-assertions#readme
- Issues: https://github.com/davidpaulhunt/ask-assertions/issues
- npm.io page: https://npm.io/package/ask-assertions

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2019-05-01
- 1.0.2 — 2019-03-06
- 1.0.1 — 2019-02-27
- 1.0.0 — 2019-02-27

## README

ASK Assertions contains a number of helpers for testing common skill responses in projects built with the amazing [Alexa Skills Kit SDK for Node.js](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs).

## Disclaimer

**Although, this package is based on the helpers from the [Single Stream Audio Skill](https://github.com/alexa/skill-sample-nodejs-audio-player/tree/mainline/single-stream), it is in no way affiliated with or endorsed by Amazon or the Alexa team.**

## Installation

Install `ask-assertions` as a devDependency:

```bash
$ npm i -D ask-assertions
```

> Note: `ask-assertions` requires the following peerDependencies
>
> - `ask-sdk-models` >= 1.11.x
> - `chai` >= 4.2.x

## Usage

_Example using mocha + chai with TypeScript._

```typescript
import "mocha";
import * as assertions from "ask-assertions";
import { ResponseEnvelope } from "ask-sdk-model";

import { handler as skill } from "../src/index";

let skillResponse: ResponseEnvelope;

describe("AMAZON.HelpIntent", function testHelpIntent() {
  before(() => {
    this.timeout(5000);

    return new Promise(resolve => {
      skill(helpIntentRequest, null, (_, responseEnvelope) => {
        skillResponse = responseEnvelope;
        resolve();
      });
    });
  });

  it("should return a valid skill response", () => {
    assertions.checkResponseStructure(skillResponse);
  });

  it("should return valid output speeach", () => {
    assertions.checkOutputSpeech(skillResponse);
  });

  it("should say 'This skill can do cool things'", () => {
    assertions.checkOutputSpeechContains(skillResponse, "This skill can do cool things");
  });
});
```

## Feedback

These helpers were adapated to my workflow and common use-cases. If you have ideas on how to improve or expand them, please start a discussion via Github issues. Cheers.

---
_Source: https://npm.io/package/ask-assertions · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
