Socket
Book a DemoInstallSign in
Socket

moped-sync-store-tests

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moped-sync-store-tests

A test suite for use with any moped-sync-store.

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

moped-sync-store-tests

A test suite for use with any moped-sync-store.

Dependency Status NPM version

Installation

npm install moped-sync-store-tests

Usage

'use strict';

var test = require('../../moped-sync-store-tests');
var MemoryStore = require('../');

test(new MemoryStore()).done(function () {
  console.log('Tests passed');
});

Spec

A sync store is an object with the following methods:

  • getItem(collection, itemId)
  • getInitial(filter)
  • writeChanges(changes)
  • getChanges(id, filter)

getItem(collecion, itemId)

This method returns a promise for the current value of an item. This is useful for filtering updates.

getInitial(filter)

This gets the initial state for a client. It should be an object with two properties:

  • state
  • next

next is the Id to give to getChanges in order to get changes since this state. state is the current state of all objects allowed by filter. It is an object with a property for each collection, containg an array of values that match the corresponding filter.

writeChanges(changes)

Writes an array of changes.

getChanges(id, filter)

Gets all the changes since id that match filter. Returns {changes: [array of changes], next: [Id to give to next getChanges call]}

License

MIT

FAQs

Package last updated on 27 Jul 2014

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