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

ibm-shopping-list-model

Package Overview
Dependencies
Maintainers
5
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ibm-shopping-list-model - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

2

package.json
{
"name": "ibm-shopping-list-model",
"version": "0.1.8",
"version": "0.1.9",
"description": "Domain model implementation for the Shopping List series of Offline First demo apps.",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -410,3 +410,3 @@ [![Build Status](https://travis-ci.org/ibm-watson-data-lab/shopping-list-model-js.svg?branch=master)](https://travis-ci.org/ibm-watson-data-lab/shopping-list-model-js)

#### Reading a Shopping List Item List from a Database
#### Find Shopping List Items for a Shopping List from a Database

@@ -449,3 +449,3 @@ Use a Shopping List Repository to read a Shopping List Item List from the database when you know the `_id` value of the parent Shopping List:

}).then(groceriesItemList => {
return shoppingListRepository.getItemList(shoppingList._id);
return shoppingListRepository.findItems(shoppingList._id);
}).then(groceriesItemList => {

@@ -452,0 +452,0 @@ console.log(groceriesItemList.get(0).title); // Mangos

@@ -21,8 +21,8 @@ "use strict";

findItems(shoppingListId) {}
deleteItem(shoppingListItem) { }
getItemList(shoppingListId) {}
}
exports.ShoppingListRepository = ShoppingListRepository;

@@ -141,8 +141,3 @@ "use strict";

deleteItem(shoppingListItem) {
this._guardShoppingListItem(shoppingListItem);
return this._delete(shoppingListItem);
}
getItemList(shoppingListId) {
findItems(shoppingListId) {
return this.db.find({

@@ -161,4 +156,9 @@ selector: {

deleteItem(shoppingListItem) {
this._guardShoppingListItem(shoppingListItem);
return this._delete(shoppingListItem);
}
}
exports.ShoppingListRepositoryPouchDB = ShoppingListRepositoryPouchDB;

@@ -254,2 +254,62 @@ "use strict";

it("should find Shopping List Items for a Shopping List", function(done) {
const groceries = this.shoppingListFactory.newShoppingList({
title: "Groceries"
});
let clock;
let mangos;
let oranges;
let pears;
this.shoppingListRepository.ensureIndexes().should.be.fulfilled.then(result => {
return this.shoppingListRepository.post(groceries);
}).should.be.fulfilled.then(groceriesAfterPost => {
clock = sinon.useFakeTimers(1504060809314);
mangos = this.shoppingListFactory.newShoppingListItem({
title: "Mangos"
}, groceries);
oranges = this.shoppingListFactory.newShoppingListItem({
title: "Oranges"
}, groceries);
pears = this.shoppingListFactory.newShoppingListItem({
title: "Pears"
}, groceries);
const groceriesItemList = this.shoppingListFactory.newShoppingListItemList([mangos, oranges, pears]);
return this.shoppingListRepository.postItemsBulk(groceriesItemList);
}).should.be.fulfilled.then(groceriesItemList => {
return this.shoppingListRepository.findItems(groceries._id);
}).should.be.fulfilled.then(groceriesItemList => {
List.isList(groceriesItemList).should.be.true;
groceriesItemList.isEmpty().should.be.false;
groceriesItemList.size.should.equal(3);
const mangosAfterPost = groceriesItemList.get(0);
const orangesAfterPost = groceriesItemList.get(1);
const pearsAfterPost = groceriesItemList.get(2);
mangosAfterPost.should.have.deep.property("_id", mangos._id);
mangosAfterPost.should.have.deep.property("_rev").that.is.a("string");
mangosAfterPost.should.have.deep.property("type", "item");
mangosAfterPost.should.have.deep.property("list", groceries._id);
mangosAfterPost.should.have.deep.property("title", "Mangos");
mangosAfterPost.should.have.deep.property("checked", false);
mangosAfterPost.should.have.deep.property("createdAt", "2017-08-30T02:40:09.314Z");
mangosAfterPost.should.have.deep.property("updatedAt", "2017-08-30T02:40:09.314Z");
orangesAfterPost.should.have.deep.property("_id", oranges._id);
orangesAfterPost.should.have.deep.property("_rev").that.is.a("string");
orangesAfterPost.should.have.deep.property("type", "item");
orangesAfterPost.should.have.deep.property("list", groceries._id);
orangesAfterPost.should.have.deep.property("title", "Oranges");
orangesAfterPost.should.have.deep.property("checked", false);
orangesAfterPost.should.have.deep.property("createdAt", "2017-08-30T02:40:09.314Z");
orangesAfterPost.should.have.deep.property("updatedAt", "2017-08-30T02:40:09.314Z");
pearsAfterPost.should.have.deep.property("_id", pears._id);
pearsAfterPost.should.have.deep.property("_rev").that.is.a("string");
pearsAfterPost.should.have.deep.property("type", "item");
pearsAfterPost.should.have.deep.property("list", groceries._id);
pearsAfterPost.should.have.deep.property("title", "Pears");
pearsAfterPost.should.have.deep.property("checked", false);
pearsAfterPost.should.have.deep.property("createdAt", "2017-08-30T02:40:09.314Z");
pearsAfterPost.should.have.deep.property("updatedAt", "2017-08-30T02:40:09.314Z");
clock.restore();
}).should.notify(done);
});
it("should update a Shopping List Item", function(done) {

@@ -324,62 +384,2 @@ const groceries = this.shoppingListFactory.newShoppingList({

it("should read a Shopping List Item List", function(done) {
const groceries = this.shoppingListFactory.newShoppingList({
title: "Groceries"
});
let clock;
let mangos;
let oranges;
let pears;
this.shoppingListRepository.ensureIndexes().should.be.fulfilled.then(result => {
return this.shoppingListRepository.post(groceries);
}).should.be.fulfilled.then(groceriesAfterPost => {
clock = sinon.useFakeTimers(1504060809314);
mangos = this.shoppingListFactory.newShoppingListItem({
title: "Mangos"
}, groceries);
oranges = this.shoppingListFactory.newShoppingListItem({
title: "Oranges"
}, groceries);
pears = this.shoppingListFactory.newShoppingListItem({
title: "Pears"
}, groceries);
const groceriesItemList = this.shoppingListFactory.newShoppingListItemList([mangos, oranges, pears]);
return this.shoppingListRepository.postItemsBulk(groceriesItemList);
}).should.be.fulfilled.then(groceriesItemList => {
return this.shoppingListRepository.getItemList(groceries._id);
}).should.be.fulfilled.then(groceriesItemList => {
List.isList(groceriesItemList).should.be.true;
groceriesItemList.isEmpty().should.be.false;
groceriesItemList.size.should.equal(3);
const mangosAfterPost = groceriesItemList.get(0);
const orangesAfterPost = groceriesItemList.get(1);
const pearsAfterPost = groceriesItemList.get(2);
mangosAfterPost.should.have.deep.property("_id", mangos._id);
mangosAfterPost.should.have.deep.property("_rev").that.is.a("string");
mangosAfterPost.should.have.deep.property("type", "item");
mangosAfterPost.should.have.deep.property("list", groceries._id);
mangosAfterPost.should.have.deep.property("title", "Mangos");
mangosAfterPost.should.have.deep.property("checked", false);
mangosAfterPost.should.have.deep.property("createdAt", "2017-08-30T02:40:09.314Z");
mangosAfterPost.should.have.deep.property("updatedAt", "2017-08-30T02:40:09.314Z");
orangesAfterPost.should.have.deep.property("_id", oranges._id);
orangesAfterPost.should.have.deep.property("_rev").that.is.a("string");
orangesAfterPost.should.have.deep.property("type", "item");
orangesAfterPost.should.have.deep.property("list", groceries._id);
orangesAfterPost.should.have.deep.property("title", "Oranges");
orangesAfterPost.should.have.deep.property("checked", false);
orangesAfterPost.should.have.deep.property("createdAt", "2017-08-30T02:40:09.314Z");
orangesAfterPost.should.have.deep.property("updatedAt", "2017-08-30T02:40:09.314Z");
pearsAfterPost.should.have.deep.property("_id", pears._id);
pearsAfterPost.should.have.deep.property("_rev").that.is.a("string");
pearsAfterPost.should.have.deep.property("type", "item");
pearsAfterPost.should.have.deep.property("list", groceries._id);
pearsAfterPost.should.have.deep.property("title", "Pears");
pearsAfterPost.should.have.deep.property("checked", false);
pearsAfterPost.should.have.deep.property("createdAt", "2017-08-30T02:40:09.314Z");
pearsAfterPost.should.have.deep.property("updatedAt", "2017-08-30T02:40:09.314Z");
clock.restore();
}).should.notify(done);
});
});
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