Skip to content

Types #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 93 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"mocha": "9.2.2",
"prettier": "3.3.3",
"sinon": "13.0.1",
"ts-node": "10.4.0",
"typescript": "4.7.4"
"ts-node": "10.9.2",
"typescript": "5.3.3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should upgrade to latest in the official PR (after having confirmed it works with the CM5 version)

}
}
4 changes: 2 additions & 2 deletions src/__tests__/aliases.tests.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

import { expect } from 'chai';
import { jsonToGraphQLQuery } from '../';
import { jsonToGraphQLQuery, type QueryJSON } from '../';

describe('jsonToGraphQLQuery() - aliases', () => {

it('supports multiple aliases for one type', () => {
const query = {
const query: QueryJSON = {
query: {
lorem: {
__aliasFor: 'Posts',
Expand Down
18 changes: 9 additions & 9 deletions src/__tests__/arguments.tests.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

import { expect } from 'chai';
import { jsonToGraphQLQuery } from '../';
import { jsonToGraphQLQuery, type QueryJSON } from '../';

describe('jsonToGraphQLQuery() - arguments', () => {

it('converts a query with simple arguments', () => {
const query = {
const query: QueryJSON = {
query: {
Posts: {
__args: {
Expand All @@ -29,7 +29,7 @@ describe('jsonToGraphQLQuery() - arguments', () => {
});

it('converts a query with JSON arguments', () => {
const query = {
const query: QueryJSON = {
query: {
Posts: {
__args: {
Expand All @@ -56,7 +56,7 @@ describe('jsonToGraphQLQuery() - arguments', () => {
});

it('converts a query with JSON arguments containing arrays of objects', () => {
const query = {
const query: QueryJSON = {
query: {
Posts: {
__args: {
Expand All @@ -83,7 +83,7 @@ describe('jsonToGraphQLQuery() - arguments', () => {
});

it('converts a query with null arguments and nested nulls', () => {
const query = {
const query: QueryJSON = {
query: {
Posts: {
__args: {
Expand All @@ -97,7 +97,7 @@ describe('jsonToGraphQLQuery() - arguments', () => {
post_date: true
}
}
} as any;
};
expect(jsonToGraphQLQuery(query, { pretty: true })).to.equal(
`query {
Posts (where: {id: null}, orderBy: null) {
Expand All @@ -109,7 +109,7 @@ describe('jsonToGraphQLQuery() - arguments', () => {
});

it('converts a query with nested objects and arguments', () => {
const query = {
const query: QueryJSON = {
query: {
Posts: {
__args: {
Expand Down Expand Up @@ -144,7 +144,7 @@ describe('jsonToGraphQLQuery() - arguments', () => {
});

it('works with pretty mode turned off', () => {
const query = {
const query: QueryJSON = {
query: {
Posts: {
__args: {
Expand All @@ -162,7 +162,7 @@ describe('jsonToGraphQLQuery() - arguments', () => {
});

it('Empty args object should not generate parentheses', () => {
const query = {
const query: QueryJSON = {
query: {
Posts: {
__args: {},
Expand Down
Loading