Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ssddOnTop committed Sep 25, 2024
1 parent 34065f6 commit 6ef3c15
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/core/snapshots/test-invalid-add-field.md_error.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
source: tests/core/spec.rs
expression: errors
---
[
{
"message": "Parsing failed because of invalid type: string \"{{.value.user.username}}\", expected a sequence",
"trace": [
"PostUser",
"@addField",
"path"
],
"description": null
}
]
31 changes: 31 additions & 0 deletions tests/execution/test-invalid-add-field.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
error: true
---

# Test invalid add fields

```graphql @config
schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") {
query: Query
}

type Query {
postuser: [PostUser] @http(path: "/posts")
}

type PostUser @addField(name: "username", path: "{{.value.user.username}}") {
id: Int! @modify(name: "postId")
title: String!
userId: Int!
user: User @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/{{.value.userId}}")
}

type User {
id: Int!
name: String!
username: String!
email: String!
phone: String
website: String
}
```

0 comments on commit 6ef3c15

Please sign in to comment.