Skip to content

Commit

Permalink
ft previous
Browse files Browse the repository at this point in the history
  • Loading branch information
mgamal committed Jan 6, 2023
1 parent 3dedae8 commit 136614c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Initial DB', () => {

describe('Pagination', () => {
it('Should retrieve users with pagination data', async () => {
const createdUser = await User.paginate({}, 'roles');
const createdUser = await User.paginate({}, 'roles.description');

expect(createdUser.totalResults).toBeDefined();
expect(createdUser.page).toBeGreaterThan(0);
Expand All @@ -34,7 +34,7 @@ describe('Pagination', () => {

describe('Pagination & Population', () => {
it('Should retrieve users with pagination data and population', async () => {
const createdUser = await User.paginate({}, 'roles');
const createdUser = await User.paginate({}, 'roles.description');

expect(createdUser.totalResults).toBeGreaterThan(0);

Expand All @@ -48,7 +48,7 @@ describe('Pagination & Population', () => {

describe('Pagination & Population & Query', () => {
it('Should retrieve users with pagination data, population and find query', async () => {
const createdUser = await User.paginate({}, 'roles', {
const createdUser = await User.paginate({}, 'roles.description', {
email: {
$regex: 'kashier',
$options: 'i'
Expand Down Expand Up @@ -87,16 +87,13 @@ describe('Pagination & Population & Query ', () => {

describe('Pagination with options & Population & Query ', () => {
it('Should retrieve users with pagination data, population, find query and pagination data', async () => {
const createdUser = await User.paginate({ page: 1, limit: 2 }, 'roles', {
const createdUser = await User.paginate({ page: 1, limit: 2 }, 'roles.description', {
email: {
$regex: 'kashier',
$options: 'i'
}
});

const usersCount = User.count();

console.log(usersCount);
expect(createdUser.totalResults).toBeGreaterThan(0);

expect(createdUser.page).toBeGreaterThan(0);
Expand Down

0 comments on commit 136614c

Please sign in to comment.