-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mbaye THIAM
committed
Apr 16, 2024
1 parent
b5c3a68
commit bffe680
Showing
8 changed files
with
105 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { test, expect } from 'vitest' | ||
import axios from 'axios' | ||
import { url, headers } from '../config' | ||
|
||
/* SPL filter */ | ||
const getTenFirstProductsQuery = /* GraphQL */ ` | ||
query getTenFirstProducts { | ||
getProducts { | ||
items @SPL(query: "id <= 10") { | ||
name | ||
id | ||
price | ||
supplierId | ||
} | ||
} | ||
} | ||
` | ||
|
||
test('getTenFirstProducts with SPL filter query', async () => { | ||
const response = await axios.post(url, { query: getTenFirstProductsQuery }, { headers }) | ||
Check failure on line 20 in test/integration/tests/cases/directive-spl.test.ts GitHub Actions / integration-tests (18.x)cases/directive-spl.test.ts > getTenFirstProducts with SPL filter query
|
||
|
||
const result = response.data | ||
expect(response.status).toBe(200) | ||
expect(result.data.getProducts.items.length).toEqual(10) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
test/integration/tests/cases/inject-additionnal-transforms.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { test, expect } from 'vitest' | ||
import axios from 'axios' | ||
import { url, headers } from '../config' | ||
|
||
/* Get all products */ | ||
const getProductById = /* GraphQL */ ` | ||
query getProduct { | ||
getProductById(id: 1) { | ||
name @lower | ||
price | ||
supplierId | ||
} | ||
} | ||
` | ||
|
||
test('Injection lower transform', async () => { | ||
const response = await axios.post(url, { query: getProductById }, { headers }) | ||
|
||
const result = response.data | ||
expect(result).toHaveProperty('data') | ||
expect(result.data.getProductById.name).toEqual('product 1') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { test, expect } from 'vitest' | ||
import axios from 'axios' | ||
import { url, headers } from '../config' | ||
|
||
/* Get all products */ | ||
const getProductById = /* GraphQL */ ` | ||
query getProduct { | ||
getProductById(id: 1) { | ||
name | ||
price | ||
supplierId | ||
} | ||
} | ||
` | ||
|
||
test('Server timing plugin', async () => { | ||
const response = await axios.post(url, { query: getProductById }, { headers }) | ||
const serverTiming = response.headers['server-timing'] | ||
expect(serverTiming).contains('getProductById;desc="getProductById (Products)";dur') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const url = 'http://0.0.0.0:45538/graphql' | ||
// export const url = 'http://0.0.0.0:4000/graphql' | ||
export const headers = { 'Content-Type': 'application/json' } |