🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@almin/store-test-helper

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@almin/store-test-helper

Create Store helper for testing.

latest
Source
npmnpm
Version
1.1.4
Version published
Maintainers
1
Created
Source

@almin/store-test-helper

Create Store helper for testing.

Install

Install with npm:

npm install @almin/store-test-helper

Usage

import { Store } from "almin";
export interface MockStore<T> extends Store<T> {
    updateStateWithoutEmit(newState: T): void;
    updateState(newState: T): void;
    getState(): any;
}
/**
 * This helper is for creating Store
 * @example
 * // state only
 * // name is increment number automatically
 * createStore({ value: "state" });
 * // with name
 * createStore("Store Name", { value: "state" });
 *
 */
export declare function createStore<T>(storeName: string, initialState: T): MockStore<T>;
export declare function createStore<T>(initialState: T): MockStore<T>;

Example

const initialState = {
    value: "value"
};
const store = createStore("TestStore", initialState);
assert.ok(store instanceof Store);
assert.strictEqual(store.name, "TestStore");
assert.deepStrictEqual(store.getState(), initialState);

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am 'Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request :D

Author

License

MIT © azu

Keywords

almin

FAQs

Package last updated on 12 Jul 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