senter-mongo-repository
Advanced tools
Comparing version 3.2.1 to 3.3.0
@@ -1,1 +0,1 @@ | ||
{"mongoUri":"mongodb://127.0.0.1:49571/"} | ||
{"mongoUri":"mongodb://127.0.0.1:62759/"} |
@@ -102,3 +102,3 @@ const uuid = require('uuid').v4 | ||
try { | ||
var query = this._collection.find(searchTerm) | ||
let query = this._collection.find(searchTerm); | ||
if (sorting) { | ||
@@ -478,2 +478,2 @@ query = query.sort(sorting) | ||
module.exports = MongoRepository | ||
module.exports = MongoRepository |
{ | ||
"name": "senter-mongo-repository", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"description": "Contain methods to work with mongo db", | ||
@@ -12,3 +12,3 @@ "main": "mongoReposotory.js", | ||
"dependencies": { | ||
"mongodb": "^4.1.2", | ||
"mongodb": "^4.9.0", | ||
"uuid": "^8.3.2" | ||
@@ -15,0 +15,0 @@ }, |
@@ -13,3 +13,3 @@ const MongoRepository = require("../mongoReposotory") | ||
var lastOrganisationId = 1 | ||
let lastOrganisationId = 1; | ||
@@ -32,6 +32,6 @@ expect.extend({ | ||
describe("getById", () => { | ||
var repository | ||
var organisationId | ||
var client | ||
var id | ||
let repository; | ||
let organisationId; | ||
let client; | ||
let id; | ||
@@ -173,6 +173,6 @@ beforeAll(async () => { | ||
describe("search", () => { | ||
var repository | ||
var organisationId | ||
var client | ||
var ids = [] | ||
let repository; | ||
let organisationId; | ||
let client; | ||
const ids = []; | ||
@@ -190,3 +190,3 @@ beforeAll(async () => { | ||
organisationId = lastOrganisationId.toString() | ||
lastOrganisationId++; | ||
lastOrganisationId++ | ||
}) | ||
@@ -238,3 +238,3 @@ | ||
test("should return requested page of requested size", async () => { | ||
test.only("should return requested page of requested size", async () => { | ||
ids.push(uuid()) | ||
@@ -254,21 +254,22 @@ ids.push(uuid()) | ||
const col = client.db(dbName).collection(collectionName); | ||
ids.forEach(async (id, index) =>{ | ||
await col.insertOne({ | ||
for (const id of ids) { | ||
const index = ids.indexOf(id) | ||
const item = { | ||
_id: id, | ||
organisationId: organisationId, | ||
name: index.toString() | ||
}) | ||
}) | ||
name: index | ||
} | ||
await col.insertOne(item) | ||
} | ||
const result = await repository.search({ | ||
organisationId: organisationId | ||
}, { page: 1, pageSize: 4 }) | ||
const result = await repository.search({ organisationId: organisationId }, | ||
{ page: 1, pageSize: 4 }, | ||
{ name: 1 }) | ||
expect(result).toNotBeNullOrUndefined() | ||
expect(result.length).toBe(4) | ||
console.log(result) | ||
expect(result[0].name).toEqual('4') | ||
expect(result[1].name).toEqual('5') | ||
expect(result[2].name).toEqual('6') | ||
expect(result[3].name).toEqual('7') | ||
expect(result[0].name).toEqual(4) | ||
expect(result[1].name).toEqual(5) | ||
expect(result[2].name).toEqual(6) | ||
expect(result[3].name).toEqual(7) | ||
}) | ||
@@ -967,2 +968,2 @@ | ||
}); | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1179
44968
Updatedmongodb@^4.9.0