Skip to content

Commit

Permalink
chore: update mongoose 8
Browse files Browse the repository at this point in the history
  • Loading branch information
meabed committed Nov 1, 2023
1 parent 8248376 commit a70b592
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/__tests__/__snapshots__/integration-test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`integration tests projection should request all fields to rawData field: projection from all fields 1`] = `
Array [
[
"__v",
"_id",
"age",
Expand All @@ -24,9 +24,9 @@ Array [
`;

exports[`integration tests projection should request only fields from query: projection from query fields 1`] = `
Object {
"data": Object {
"user": Object {
{
"data": {
"user": {
"name": "Name",
},
},
Expand Down
6 changes: 4 additions & 2 deletions src/resolvers/__tests__/findMany-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ describe('findMany() ->', () => {
'_ID_DESC',
'NAME_ASC',
'NAME_DESC',
'NAME__AGE_ASC',
'NAME__AGE_DESC',
'AGE__NAME_ASC',
'AGE__NAME_DESC',
// 'NAME__AGE_ASC',
// 'NAME__AGE_DESC',
])
);
const res = await testFieldConfig({
Expand Down
13 changes: 9 additions & 4 deletions src/resolvers/helpers/__tests__/sort-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { sortHelperArgs, sortHelper, getSortTypeFromModel } from '../sort';
import { UserModel } from '../../../__mocks__/userModel';
import { convertModelToGraphQL } from '../../../fieldsConverter';
import { getIndexesFromModel } from '../../../utils';
import * as console from 'console';

describe('Resolver helper `sort` ->', () => {
let UserTC: ObjectTypeComposer<any, any>;
Expand Down Expand Up @@ -39,13 +40,17 @@ describe('Resolver helper `sort` ->', () => {
const enumNames = etc.getFieldNames();
expect(enumNames).toEqual(expect.arrayContaining(['_ID_ASC', '_ID_DESC']));

// const complexASC = etc.getField('NAME__AGE_ASC');
// expect(complexASC.value).toEqual({ name: 1, age: -1 });
// @FIXME mongoose 8 assigning fields schema when they have aliases to last

// should have ASC criteria for mongoose
const complexASC = etc.getField('NAME__AGE_ASC');
expect(complexASC.value).toEqual({ name: 1, age: -1 });
const complexASC = etc.getField('AGE__NAME_ASC');
expect(complexASC.value).toEqual({ age: 1, name: -1 });

// should have DESC criteria for mongoose
const complexDESC = etc.getField('NAME__AGE_DESC');
expect(complexDESC.value).toEqual({ name: -1, age: 1 });
const complexDESC = etc.getField('AGE__NAME_DESC');
expect(complexDESC.value).toEqual({ age: -1, name: 1 });
});
});

Expand Down

0 comments on commit a70b592

Please sign in to comment.