Skip to content

Commit

Permalink
Adding test case to highlight issue cult-of-coders#386
Browse files Browse the repository at this point in the history
  • Loading branch information
vparpoil committed Oct 22, 2019
1 parent 9fc2407 commit d92b7d8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/query/testing/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,36 @@ describe("Hypernova", function() {
const [cart] = data;
assert.isUndefined(cart.user);
});
it("Should not remove link storage fields if they are asked in the query", () => {
ShoppingCart.remove({});
const cartId = ShoppingCart.insert({
date: new Date(),
items: [{title: "Something"}]
});

Clients.remove({});
Clients.insert({
name: "John",
shoppingCartData: {
prime: 1,
_id: cartId
}
});

const data = Clients.createQuery({
shoppingCart: {
date: 1
},
shoppingCartData: 1
}).fetch();
assert.equal(data.length, 1);
const [cart] = data;
assert.isObject(cart.shoppingCart);
// shoppingCartData should be here
assert.isObject(cart.shoppingCartData);
assert.equal(cart.shoppingCartData.prime, 1);
assert.equal(cart.shoppingCartData._id, cartId);
});
it("Should remove link storage inversedBy meta unique fields", () => {
ShoppingCart.remove({});
const cartId = ShoppingCart.insert({
Expand Down

0 comments on commit d92b7d8

Please sign in to comment.