Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

api-test

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-test - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

35

classes/Find.js

@@ -21,4 +21,5 @@ 'use strict'

Find.prototype.execute = function (context, db, done) {
var selector = this.value.execute(context, '<find in ' + this.collection + '>'),
var selector = flat(this.value.execute(context, '<find in ' + this.collection + '>')),
that = this
db.collection(this.collection).findOne(selector, function (err, doc) {

@@ -34,2 +35,34 @@ if (err) {

/**
* Make a value flat, so that mongo ignore subdoc key order
* {a: {b: 2}} -> {'a.b': 2}
* @param {Object} value
* @returns {Object}
* @private
*/
function flat(value) {
var r = Object.create(null),
flatValue = function (value, prefix) {
if (Array.isArray(value)) {
// Subarray
value.forEach(function (each, i) {
flatValue(each, prefix + i + '.')
})
} else if (value &&
typeof value === 'object' &&
(value.constructor === Object || Object.getPrototypeOf(value) === null)) {
// Subdoc
Object.keys(value).forEach(function (key) {
flatValue(value[key], prefix + key + '.')
})
} else {
// Simple value
r[prefix.substr(0, prefix.length - 1)] = value
}
}
flatValue(value, '')
return r
}
module.exports = Find

5

classes/Mixin.js

@@ -147,3 +147,3 @@ 'use strict'

if (!obj || typeof obj !== 'object') {
throw new Error('Can\'t remove key ' + key + ' from non-object')
throw new Error('Can\'t add key ' + key + ' to non-object')
}

@@ -172,2 +172,5 @@

} else {
if (!(key in obj)) {
obj[key] = Object.create(null)
}
add(obj[key], value, path, i + 1)

@@ -174,0 +177,0 @@ }

@@ -6,3 +6,3 @@ 'use strict'

* @param {string} message
* @param {Header|Obj} [...el] The element that caused the error (null if not applicable)
* @param {Header|Obj} [...el] The element(s) that caused the error
* @extends Error

@@ -9,0 +9,0 @@ */

@@ -79,6 +79,7 @@ /*globals describe, before, it*/

if (rightTag) {
console.log('The mongoUri "' + mongoUri + '" seems not be test-safe')
console.log('The mongoUri "' + mongoUri.substr(0, 17) + '..." seems not to be test-safe')
console.log('I recommend you to connect to a localhost instance and a database with "test" in the name')
console.log('Remember that the database is DROPPED before every test!')
console.log('If you are really sure, please append "!' + rightTag + '!" to your mongoUri')
console.log('If you are really sure, please prepend "!' + rightTag + '!" to your mongoUri')
console.log('Like this: "!' + rightTag + '!' + mongoUri.substr(0, 17) + '..."')
} else {

@@ -85,0 +86,0 @@ console.log('Please remove the !tag! from the mongoUri to run the test')

{
"name": "api-test",
"version": "1.3.0",
"version": "1.3.1",
"author": "Sitegui <sitegui@sitegui.com.br>",

@@ -5,0 +5,0 @@ "description": "API testing made simple",

@@ -184,3 +184,2 @@ # API Test

## TODO
* Make keys less restrictive
* Ignore key ordering in find
* Make keys less restrictive
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc