From 3b7f07f2231e161f07fdf61c3095e9a5479bec14 Mon Sep 17 00:00:00 2001 From: Vladimir Vukanac Date: Mon, 19 Apr 2021 18:00:18 +0200 Subject: [PATCH] Adds test to cover one of Mongo.find/4 errors --- test/mongo_test.exs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/mongo_test.exs b/test/mongo_test.exs index 143e4928..32e6d16b 100644 --- a/test/mongo_test.exs +++ b/test/mongo_test.exs @@ -199,6 +199,10 @@ defmodule Mongo.Test do assert [%{"foo" => 44}, %{"foo" => 43}] = Mongo.find(c.pid, coll, %{}, sort: [foo: -1], batch_size: 2, limit: 2) |> Enum.to_list |> Enum.map(fn m -> Map.pop(m, "_id") |> elem(1) end) + + # one of error types + assert {:error, %Mongo.Error{message: "unknown top level operator: $foo"}} = + Mongo.find(c.pid, coll, %{"$foo" => []}) end test "find_one", c do