prop_queryGroup_Unknown :: Property
prop_queryGroup_Unknown =
  forAll (choose (0, maxNodes) >>= genEmptyCluster) $ \cluster ->
  forAll (arbitrary `suchThat` (`notElem` Map.keys Group.fieldsMap))
    $ \field -> monadicIO $ do
  QueryResult fdefs fdata <-
    run (query cluster False (Query (ItemTypeOpCode QRGroup)
                              [field] EmptyFilter)) >>= resultProp
  QueryFieldsResult fdefs' <-
    resultProp $ queryFields (QueryFields (ItemTypeOpCode QRGroup) [field])
  _ <- stop $ conjoin
         [ counterexample ("Got known fields via query (" ++ show fdefs ++ ")")
           (not $ hasUnknownFields fdefs)
         , counterexample ("Got /= ResultUnknown result status via query (" ++
                           show fdata ++ ")")
           (all (all ((== RSUnknown) . rentryStatus)) fdata)
         , counterexample ("Got a Just in a result value (" ++
                           show fdata ++ ")")
           (all (all (isNothing . rentryValue)) fdata)
         , counterexample ("Got known fields via query fields (" ++ show fdefs'
                           ++ ")") (not $ hasUnknownFields fdefs')
         ]
  return ()
prop_queryGroup_Unknown :: Property
prop_queryGroup_Unknown =
  forAll (choose (0, maxNodes) >>= genEmptyCluster) $ \cluster ->
  forAll (arbitrary `suchThat` (`notElem` Map.keys Group.fieldsMap))
    $ \field -> monadicIO $ do
  QueryResult fdefs fdata <-
    run (query cluster False (Query (ItemTypeOpCode QRGroup)
                              [field] EmptyFilter)) >>= resultProp
  QueryFieldsResult fdefs' <-
    resultProp $ queryFields (QueryFields (ItemTypeOpCode QRGroup) [field])
  _ <- stop $ conjoin
         [ counterexample ("Got known fields via query (" ++ show fdefs ++ ")")
           (not $ hasUnknownFields fdefs)
         , counterexample ("Got /= ResultUnknown result status via query (" ++
                           show fdata ++ ")")
           (all (all ((== RSUnknown) . rentryStatus)) fdata)
         , counterexample ("Got a Just in a result value (" ++
                           show fdata ++ ")")
           (all (all (isNothing . rentryValue)) fdata)
         , counterexample ("Got known fields via query fields (" ++ show fdefs'
                           ++ ")") (not $ hasUnknownFields fdefs')
         ]
  return ()
prop_queryGroup_Unknown =
  forAll (choose (0, maxNodes) >>= genEmptyCluster) $ \cluster ->
  forAll (arbitrary `suchThat` (`notElem` Map.keys Group.fieldsMap))
    $ \field -> monadicIO $ do
  QueryResult fdefs fdata <-
    run (query cluster False (Query (ItemTypeOpCode QRGroup)
                              [field] EmptyFilter)) >>= resultProp
  QueryFieldsResult fdefs' <-
    resultProp $ queryFields (QueryFields (ItemTypeOpCode QRGroup) [field])
  _ <- stop $ conjoin
         [ counterexample ("Got known fields via query (" ++ show fdefs ++ ")")
           (not $ hasUnknownFields fdefs)
         , counterexample ("Got /= ResultUnknown result status via query (" ++
                           show fdata ++ ")")
           (all (all ((== RSUnknown) . rentryStatus)) fdata)
         , counterexample ("Got a Just in a result value (" ++
                           show fdata ++ ")")
           (all (all (isNothing . rentryValue)) fdata)
         , counterexample ("Got known fields via query fields (" ++ show fdefs'
                           ++ ")") (not $ hasUnknownFields fdefs')
         ]
  return ()