npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@objectkit/scriptex.mock

v1.0.0

Published

A mock object library for the Scripter MIDI-FX Plugin

Downloads

26

Readme

@objectkit/scriptex.mock

A collection of test interfaces and helpers to mock the Scripter MIDI-FX Plugin environment.

Documentation

Please refer to specs for more information.

Installation

npm i @objectkit/scriptex.mock

API

Global interface

Data interfaces

Event interfaces

Environmental Helpers

VirtualScripter

A bare bones Scripter emulation.

DeployPluginHarness

A convenience tool for capturing api, plugin and system references arising through deployment.

VirtualScripterEnvironment

A virtual Scripter environment assembled by VirtualScripter and DeployPluginHarness configurations.

Use cases

Inspect the Microtuner plugin demonstrator for concrete applications or clone the plugin project template to use it in a development context.

Example

The #system property of scriptex plugin instances gives uniform instance level access to the global scope, but that is not useful to all test and deployment scenarios. There are times when access to a simulated gloabl Scripter scope in the test environment will be of better help, and VirtualScripterEnvironment provides the means for that to happen.

import { PitchBend, VirtualScripterEnvironment } from "@objectkit/scriptex.mock"
import { Microtuner } from "scriptex.plugin.microtuner"

describe(`Microtuner Integration`, () => {

  /* link the virtual environemnet to the global scope */
  const virtual= new VirtualScripterEnvironment(global)
  const sandbox= sinon.createSandbox()

  beforeEach(() => {
<<<<<<< HEAD
    /* pre-test: decorate the virtual target, i.e. global scope in this test */
    virtual.applyEnvironment()  
  })

  afterEach(() => {
    /* post-test: undecorate and restore the global scope */
    virtual.unapplyEnvironment()
    sandbox.restore()
  })

  describe(`Given Microtuner has been deployed to Scripter`, () => {
    describe(`When SetParameter is invoked`, () => {
      specify(`Then a new PitchBend is sent.`, () => {

        /* make system properties modifiable for tests */
        Microtuner.CONFIGURABLE= true

        /* export Scripter methods and properties to the global scope */
        const { plugin, system } = virtual.deployPlugin(Microtuner)
        const { SendMIDIEventNow, ParameterChanged, Trace }= sandbox.spy(system)          
        const [ { minValue, maxValue, defaultValue } ]= plugin.parameters
        const { applyPitchBend, onParameter }= sandbox.spy(plugin)
        const { send } = sandbox.spy(Event.prototype )
=======
    virtual.applyEnvironment()
  })

  afterEach(() => {
    sandbox.restore()  
    virtual.unapplyEnvironment()
  })

  describe(`Given Microtuner is integrated with Scripter`, () => {
    describe(`When SetParameter sets the value of #microtuning`, () => {
      describe(`Then #microtuning sets the value of PitchBend#value`, () => {
        specify(`And the PitchBend is immediately sent.`, () => {

          Microtuner.CONFIGURABLE= true

          const { plugin, system } = virtual.deployPlugin(Microtuner)
          const { SendMIDIEventNow, ParameterChanged, Trace }= sandbox.spy(system)          
          const [ { minValue, maxValue, defaultValue } ]= plugin.params
          const { applyPitchBend, onParam }= sandbox.spy(plugin)
          const { send } = sandbox.spy(Event.prototype )
>>>>>>> 657e115b5b4cda3162fe54ad0c716889066fcb39

        /* emulated `Run Script` to setup the parameter view */
        UpdatePluginParameters()

        const runScenario = (val) => {

          SetParameter(0, val)

          {
            assert.callOrder(
              ParameterChanged
              , onParameter
                , applyPitchBend
                  , send
                    , SendMIDIEventNow
            )

<<<<<<< HEAD
            const { lastCall: { firstArg:pitchBend } }= SendMIDIEventNow
            assert.instanceOf(pitchBend, PitchBend)
            assert.strictEqual(pitchBend.value, val)
            assert.strictEqual(GetParameter(0), val)
=======
              const { lastCall: { firstArg: pitchBend } }= SendMIDIEventNow
              assert.instanceOf(pitchBend, PitchBend)
              assert.strictEqual(pitchBend.value, val)
              assert.strictEqual(GetParameter(0), val)
            }
>>>>>>> 657e115b5b4cda3162fe54ad0c716889066fcb39
          }
        }

        runScenario(minValue)
        runScenario(maxValue)
        runScenario(defaultValue)
      })
    })
  })
})

Donations

paypal