New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@asdgf/testing-helpers

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asdgf/testing-helpers

A stupid simple way to test

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

@asdgf/testing-helpers

A stupid simple way to test

No magic, no nonsense.

Opinionated package of small, performant, minified, ESM-friendly reexported helper libraries

Sinon ➡️ Hanbi

import { spy, stub, stubMethod, restore } from '@asdgf/testing-helpers/hanbi/index.js';

Chai ➡️ uvu/assert

import { assert } from '@asdgf/testing-helpers/uvu/assert/index.js';

@open-wc/testing-helpers fixture

import { fixture, fixtureCleanup, html } from '@asdgf/testing-helpers/open-wc/index.js';

@open-wc/testing-helpers timing

import { waitUntil, nextFrame, aTimeout } from '@asdgf/testing-helpers/open-wc/timing/index.js';

Example usage

import { describe } from '@asdgf/core';
import * as hanbi from '@asdgf/testing-helpers/hanbi/index.js';
import { assert } from '@asdgf/testing-helpers/uvu/assert/index.js';
import { fixture, fixtureCleanup } from '@asdgf/testing-helpers/open-wc/index.js';

class MyElement extends HTMLElement {
  getName() {
    return 'world';
  }
  connectedCallback() {
    this.innerHTML = `<h1>hello ${this.getName()}</h1>`;
  }
}
customElements.define('my-element', MyElement);

describe('my-element', ({it, afterEach}) => {
  afterEach(fixtureCleanup);

  it('renders correctly', async () =>{
    const el = await fixture('<my-element></my-element>');
    const stub = hanbi.stubMethod(el, 'getName').returns('foo');
    el.connectedCallback();
    assert(el.textContent, 'hello foo');
    stub.restore();
  });
});

Keywords

FAQs

Package last updated on 01 Oct 2021

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