Skip to content
Playground(another site)

bynk.test.peek_not_a_database

Error D1.peek names a capability that is not derived from D1; only a D1 binding has a test database to read.

D1.peek reads a D1 database, so it names a capability derived from D1 (capability Orders = D1). A capability on another binding, such as Kv, has no database for it to read.

Example

shop/orders.bynk
capability Orders = D1
capability Sessions = Kv
// tests/orders.test.bynk
suite shop.orders as system {
case "peeks" {
let db = D1.peek(shop.orders.Sessions) // ✗ a `Kv`, not a `D1`
let ok = D1.peek(shop.orders.Orders) // ✓
expect true
}
}

In the Book

See also

  • The grammar rule it governs: case.
  • Every code in its category, Tests, on the diagnostic index.
  • bynk explain bynk.test.peek_not_a_database shows the same from the installed toolchain, without a network.