Add ESLint. Adopted standards (#7)
This commit is contained in:
Родитель
5e790f9183
Коммит
568d675f81
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "standard"
|
||||
}
|
|
@ -14,6 +14,12 @@
|
|||
"author": "Ben Greenier",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-standard": "^11.0.0",
|
||||
"eslint-plugin-import": "^2.11.0",
|
||||
"eslint-plugin-node": "^6.0.1",
|
||||
"eslint-plugin-promise": "^3.7.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"mocha": "^5.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
const assert = require('assert')
|
||||
const index = require('../')
|
||||
|
||||
/* eslint-env node, mocha */
|
||||
|
||||
describe('platform-chaos', () => {
|
||||
it('is named properly', () => {
|
||||
assert.equal(require('../package.json').name, 'platform-chaos')
|
||||
|
@ -37,9 +39,9 @@ describe('platform-chaos', () => {
|
|||
}
|
||||
})[0]
|
||||
|
||||
assert.equal(instance.subscriptionId, "sub")
|
||||
assert.equal(instance.resourceGroupName, "rg")
|
||||
assert.equal(instance.resourceName, "resource")
|
||||
assert.equal(instance.subscriptionId, 'sub')
|
||||
assert.equal(instance.resourceGroupName, 'rg')
|
||||
assert.equal(instance.resourceName, 'resource')
|
||||
})
|
||||
|
||||
it('parses accessTokens', () => {
|
||||
|
@ -56,7 +58,7 @@ describe('platform-chaos', () => {
|
|||
assert.throws(() => {
|
||||
index.validators.accessToken({
|
||||
body: {
|
||||
accessToken: "valid type"
|
||||
accessToken: 'valid type'
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -65,7 +67,7 @@ describe('platform-chaos', () => {
|
|||
assert.throws(() => {
|
||||
index.validators.accessToken({
|
||||
body: {
|
||||
accessToken: "valid type"
|
||||
accessToken: 'valid type'
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -74,14 +76,14 @@ describe('platform-chaos', () => {
|
|||
assert.throws(() => {
|
||||
index.validators.accessToken({
|
||||
body: {
|
||||
accessToken: "valid type"
|
||||
accessToken: 'valid type'
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// valid
|
||||
const expectedAccessToken = "Bearer 12345234r2"
|
||||
const instance =index.parsers.accessTokenToCredentials({
|
||||
const expectedAccessToken = 'Bearer 12345234r2'
|
||||
const instance = index.parsers.accessTokenToCredentials({
|
||||
body: {
|
||||
accessToken: expectedAccessToken
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
|||
assert.ok(req.body.resources)
|
||||
req.body.resources.forEach((res) => {
|
||||
assert.ok(typeof res === 'string')
|
||||
assert.ok(1 < res.split('/').length)
|
||||
assert.ok(res.split('/').length > 1)
|
||||
assert.ok(res.split('/').length < 4)
|
||||
})
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче