-
Notifications
You must be signed in to change notification settings - Fork 6
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
test: adopt @cap-js/sqlite #157
Changes from all commits
f09b026
2a900ff
f30e547
83b14bc
87b2340
689b0a8
f74062f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,6 @@ | |
"express": "^4.17.1", | ||
"jest": "^29.3.1", | ||
"semver": "^7.4.0", | ||
"sqlite3": "^5.0.2" | ||
"@cap-js/sqlite": "^1" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"dependencies": { | ||
"@cap-js/graphql": "*" | ||
}, | ||
"devDependencies": { | ||
"@cap-js/sqlite": "*" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"dependencies": { | ||
"@cap-js/graphql": "*" | ||
}, | ||
"devDependencies": { | ||
"@cap-js/sqlite": "*" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"devDependencies": { | ||
"@cap-js/sqlite": "*" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"dependencies": { | ||
"@cap-js/graphql": "*" | ||
}, | ||
"devDependencies": { | ||
"@cap-js/sqlite": "*" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": { | ||
"@cap-js/sqlite": "*" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,19 +61,27 @@ describe('graphql - offset-based paging', () => { | |
} | ||
` | ||
const data = { | ||
AdminServiceBasic: { | ||
Authors: null | ||
AdminService: { | ||
Authors: [ | ||
{ | ||
name: 'Edgar Allen Poe', | ||
books: [ | ||
// Edgar Allen Poe has 2 books, but only 1 requested. | ||
{ | ||
title: 'Eleonora' | ||
} | ||
] | ||
}, | ||
{ | ||
name: 'Richard Carpenter', | ||
books: [] | ||
} | ||
] | ||
} | ||
} | ||
const errors = [ | ||
{ | ||
locations: [{ column: 13, line: 4 }], | ||
message: 'Pagination is not supported in expand', | ||
path: ['AdminServiceBasic', 'Authors'] | ||
} | ||
] | ||
|
||
const response = await POST('/graphql', { query }) | ||
expect(response.data).toEqual({ data, errors }) | ||
expect(response.data).toEqual({ data }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
}) | ||
}) | ||
|
||
|
@@ -139,19 +147,32 @@ describe('graphql - offset-based paging', () => { | |
` | ||
const data = { | ||
AdminService: { | ||
Authors: null | ||
Authors: { | ||
nodes: [ | ||
{ | ||
name: 'Edgar Allen Poe', | ||
books: { | ||
// Edgar Allen Poe has 2 books, but only 1 requested. | ||
nodes: [ | ||
{ | ||
title: 'Eleonora' | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
name: 'Richard Carpenter', | ||
books: { | ||
nodes: [] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
const errors = [ | ||
{ | ||
locations: [{ column: 13, line: 4 }], | ||
message: 'Pagination is not supported in expand', | ||
path: ['AdminService', 'Authors'], | ||
extensions: expect.any(Object) | ||
} | ||
] | ||
|
||
const response = await POST('/graphql', { query }) | ||
expect(response.data).toEqual({ data, errors }) | ||
expect(response.data).toEqual({ data }) | ||
}) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,19 +160,34 @@ describe('graphql - queries with totalCount', () => { | |
` | ||
const data = { | ||
AdminService: { | ||
Authors: null | ||
Authors: { | ||
totalCount: 4, | ||
nodes: [ | ||
{ | ||
name: 'Edgar Allen Poe', | ||
books: { | ||
totalCount: null, // REVISIT: expected 2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the totalCount is probably being returned as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add a BLI for us. Seems very "odata'ish" :) |
||
nodes: [ | ||
{ | ||
title: 'Eleonora' | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
name: 'Richard Carpenter', | ||
books: { | ||
totalCount: null, // REVISIT: expected 0 | ||
nodes: [] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
const errors = [ | ||
{ | ||
locations: [{ column: 11, line: 4 }], | ||
message: 'Pagination is not supported in expand', | ||
path: ['AdminService', 'Authors'], | ||
extensions: expect.any(Object) | ||
} | ||
] | ||
|
||
const response = await POST('/graphql', { query }) | ||
expect(response.data).toEqual({ data, errors }) | ||
expect(response.data).toEqual({ data }) | ||
}) | ||
|
||
test('query with aliases on totalCount on nested fields', async () => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these added for the plugin detection ?
If that is the reason it would be better to run the test with
CDS_CONFIG
to allow for testing with not just@cap-js/sqlite
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to introduce those internal flags also for open source modules.
In the meanwhile, I'd hope that there's no need anymore to switch back to the old implementation :)