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

@mojotech/prismatest-enzyme

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mojotech/prismatest-enzyme

Enzyme adapter for use with @mojotech/prismatest

  • 0.2.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
3
Weekly downloads
 
Created
Source

Prismatest Enzyme Adapter

This adapter is used to interact with your test views using Enzyme.

Element Type

Elements are interacted with using Enzyme's ReactWrapper class.

Selector Type

Selectors are specified using the Selector class. This class wraps a function that takes the current element that has been selected and may call methods on it to narrow down the selection further. For example:

import { Selector } from '@mojotech/prismatest-enzyme';

new Selector(e => e.find('.cool-class'))

Selector Helper

A helper function is provided that takes the same arguments as the find method on ReactWrapper instances. It is essentially just a wrapper around that method.

selector: (enzymeSelector) => SelectorType

Quick Start

  1. Install

    yarn install --dev @mojotech/prismatest-enzyme
    
  2. Render something

    import App from "./app";
    import { mount } from "enzyme";
    
    const rendered = mount(<App />);
    
  3. Use some test views

    import testView, { selector } from "@mojotech/prismatest-enzyme";
    import TodoComponent from './todo-component';
    
    const TodoView = testView(selector(TodoComponent), { addTodo: (e, text) => e.props().addTodo(text) });
    
    const todo = TodoView.materialize(rendered);
    
    todo.addTodo("Write some tests!");
    

FAQs

Package last updated on 28 Feb 2020

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