@brainly/onesky-utils
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -5,5 +5,5 @@ | ||
var _globals = { | ||
apiAddress: 'https://platform.api.onesky.io/' | ||
apiAddress: 'https://platform.api.onesky.io' | ||
}; | ||
module.exports = _globals; |
{ | ||
"name": "@brainly/onesky-utils", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "Node.js utils for working with OneSky translation service.", | ||
@@ -27,3 +27,3 @@ "main": "index.js", | ||
"eslint": "^5.12.0", | ||
"mocha": "^5.2.0", | ||
"mocha": "^7.2.0", | ||
"mockery": "^2.1.0", | ||
@@ -30,0 +30,0 @@ "sinon": "^7.2.2", |
@@ -54,3 +54,3 @@ /* eslint-env mocha */ | ||
response: { | ||
body: '{ message: \'Unable to upload document\', code: 400 }' | ||
body: '{ "message": "Unable to upload document", "code": 400 }' | ||
} | ||
@@ -57,0 +57,0 @@ }); |
/* eslint-env mocha */ | ||
'use strict'; | ||
"use strict"; | ||
function rootRequire (name) { | ||
return require(__dirname + '/../' + name); | ||
function rootRequire(name) { | ||
return require(__dirname + "/../" + name); | ||
} | ||
var mockery = require('mockery'); | ||
var chai = require('chai'); | ||
var mockery = require("mockery"); | ||
var chai = require("chai"); | ||
var expect = chai.expect; | ||
var sinon = require('sinon'); | ||
var sinonChai = require('sinon-chai'); | ||
var sinon = require("sinon"); | ||
var sinonChai = require("sinon-chai"); | ||
var requestPromise; | ||
@@ -19,5 +19,5 @@ var oneskyUtils; | ||
describe('POST screenshots', function () { | ||
describe("POST screenshots", function () { | ||
afterEach(function () { | ||
mockery.deregisterSubstitute('request-promise'); | ||
mockery.deregisterSubstitute("request-promise"); | ||
mockery.disable(); | ||
@@ -28,10 +28,10 @@ }); | ||
defaultOptions = { | ||
projectId: 'projectId', | ||
secret: 'secret', | ||
apiKey: 'apiKey', | ||
name: 'name', | ||
image: 'image', | ||
projectId: "projectId", | ||
secret: "secret", | ||
apiKey: "apiKey", | ||
name: "name", | ||
image: "image", | ||
tags: [ | ||
{ | ||
key: 'key', | ||
key: "key", | ||
x: 1, | ||
@@ -41,11 +41,11 @@ y: 2, | ||
height: 4, | ||
file: 'file' | ||
} | ||
] | ||
file: "file", | ||
}, | ||
], | ||
}; | ||
mockery.registerMock('request-promise', function (request) { | ||
mockery.registerMock("request-promise", function (request) { | ||
// Assert well formed request | ||
expect(request.method).to.equal('POST'); | ||
expect(request.method).to.equal("POST"); | ||
expect(request.form.secret).to.be.undefined; | ||
expect(request.form.api_key).to.equal('apiKey'); | ||
expect(request.form.api_key).to.equal("apiKey"); | ||
expect(request.form.dev_hash).to.not.be.undefined; | ||
@@ -57,5 +57,5 @@ expect(request.form.timestamp).to.not.be.undefined; | ||
expect(screenshot.name).to.equal('name'); | ||
expect(screenshot.image).to.equal('image'); | ||
expect(screenshot.tags[0].key).to.equal('key'); | ||
expect(screenshot.name).to.equal("name"); | ||
expect(screenshot.image).to.equal("image"); | ||
expect(screenshot.tags[0].key).to.equal("key"); | ||
expect(screenshot.tags[0].x).to.equal(1); | ||
@@ -65,3 +65,3 @@ expect(screenshot.tags[0].y).to.equal(2); | ||
expect(screenshot.tags[0].height).to.equal(4); | ||
expect(screenshot.tags[0].file).to.equal('file'); | ||
expect(screenshot.tags[0].file).to.equal("file"); | ||
@@ -73,14 +73,14 @@ return requestPromise; | ||
warnOnUnregistered: false, | ||
useCleanCache: true | ||
useCleanCache: true, | ||
}); | ||
oneskyUtils = rootRequire('index.js'); | ||
oneskyUtils = rootRequire("index.js"); | ||
}); | ||
it('Return error request fails with 400', function () { | ||
it("Return error request fails with 400", function () { | ||
requestPromise = new Promise(function (resolve, reject) { | ||
reject({ | ||
response: { | ||
body: "{ message: 'Unable to upload document', code: 400 }" | ||
} | ||
body: '{ "message": "Unable to upload document", "code": 400 }', | ||
}, | ||
}); | ||
@@ -96,7 +96,7 @@ }); | ||
expect(error.code).to.equal(400); | ||
expect(error.message).to.equal('Unable to upload document'); | ||
expect(error.message).to.equal("Unable to upload document"); | ||
}); | ||
}); | ||
it('Return success on valid content', function (done) { | ||
it("Return success on valid content", function (done) { | ||
var successCallback = sinon.spy(); | ||
@@ -108,4 +108,4 @@ var errorCallback = sinon.spy(); | ||
response: { | ||
body: '{"meta":{"status":201},"data":{}}' | ||
} | ||
body: '{"meta":{"status":201},"data":{}}', | ||
}, | ||
}); | ||
@@ -112,0 +112,0 @@ }); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
38543
23