# Testing Queries

A query needs no test package of its own, since a test can call the function that answers it directly.

To test a query, call the function that answers it directly, with a view filled by a projection:

```go
books, err := listBooks(catalog)(context.TODO(), ListBooks{OnlyAvailable: true})
if err != nil {
  // ...
}
```

To test the queries of an HTTP API without a database, create the API without a store, with `nil`. It answers queries, and answers a command with `500 Internal Server Error`, and logs that the API has no store:

```go
api := httpapi.NewAPI(nil, userFrom)
```
