Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions app/helpers/validate/throwMissingParameter.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const assert = require("assert")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use singlequote.

Suggested change
const assert = require("assert")
const assert = require('assert')

const throwMissingParameter = require("./throwMissingParameter");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use singlequote.

Suggested change
const throwMissingParameter = require("./throwMissingParameter");
const throwMissingParameter = require('./throwMissingParameter');


describe("helpers/validate/throwMissingParameter", () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use singlequote.

Suggested change
describe("helpers/validate/throwMissingParameter", () => {
describe('helpers/validate/throwMissingParameter', () => {

describe("fields should match object keys", () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected indentation of 2 spaces but found 4.

Suggested change
describe("fields should match object keys", () => {
describe("fields should match object keys", () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use singlequote.

Suggested change
describe("fields should match object keys", () => {
describe('fields should match object keys', () => {

it("matching keys", () => {
const object = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected indentation of 6 spaces but found 12.

Suggested change
const object = {
const object = {

keyone: "value",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use singlequote.

Suggested change
keyone: "value",
keyone: 'value',

keytwo: "another value"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use singlequote.

Suggested change
keytwo: "another value"
keytwo: 'another value'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected indentation of 8 spaces but found 16.

Suggested change
keytwo: "another value"
keytwo: "another value"

}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected indentation of 6 spaces but found 12.

Suggested change
}
}


const fields = ["keyone", "keytwo"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected indentation of 6 spaces but found 12.

Suggested change
const fields = ["keyone", "keytwo"]
const fields = ["keyone", "keytwo"]


throwMissingParameter(fields, object)
})
it("number of keys in object is greater than fields size", () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use singlequote.

Suggested change
it("number of keys in object is greater than fields size", () => {
it('number of keys in object is greater than fields size', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected indentation of 4 spaces but found 8.

Suggested change
it("number of keys in object is greater than fields size", () => {
it("number of keys in object is greater than fields size", () => {

const object = {
keyone: "value",
keytwo: "another value",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use singlequote.

Suggested change
keytwo: "another value",
keytwo: 'another value',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected indentation of 8 spaces but found 16.

Suggested change
keytwo: "another value",
keytwo: "another value",

keythree: "different value"
}

const fields = ["keyone", "keytwo"]

throwMissingParameter(fields, object)
})
it("doesn't matching keys", async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected indentation of 4 spaces but found 8.

Suggested change
it("doesn't matching keys", async () => {
it("doesn't matching keys", async () => {

const object = {
keyone: "value",
keytwo: "another value"
}

const fields = ["keyone", "randomkey"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use singlequote.

Suggested change
const fields = ["keyone", "randomkey"]
const fields = ['keyone', "randomkey"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected indentation of 6 spaces but found 12.

Suggested change
const fields = ["keyone", "randomkey"]
const fields = ["keyone", "randomkey"]



await assertFuncThrows("MissingParameter", throwMissingParameter, fields, object)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected indentation of 6 spaces but found 12.

Suggested change
await assertFuncThrows("MissingParameter", throwMissingParameter, fields, object)
await assertFuncThrows("MissingParameter", throwMissingParameter, fields, object)

})
it("object and fields are empty", async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Strings must use singlequote.

Suggested change
it("object and fields are empty", async () => {
it('object and fields are empty', async () => {

const object = {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Expected indentation of 6 spaces but found 12.

Suggested change
const object = {}
const object = {}



const fields = []


throwMissingParameter(fields, object)
})
})
})