Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit e006124

Browse files
committed
fix: remove dependency on Git(Hub)
1 parent bdc53b2 commit e006124

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ cov.*
1212
# List specific to .gitignore
1313
node_modules
1414
.idea/
15+
package-lock.json

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"http-string-parser": "0.0.5",
3434
"is-type": "0.0.1",
3535
"json-pointer": "^0.6.0",
36-
"jsonlint": "josdejong/jsonlint",
3736
"media-typer": "^0.3.0",
3837
"tv4": "^1.3.0"
3938
},
@@ -47,7 +46,7 @@
4746
"cross-spawn": "^5.1.0",
4847
"cucumber": "^1.3.2",
4948
"cz-conventional-changelog": "^2.0.0",
50-
"gavel-spec": "^1.2.0",
49+
"gavel-spec": "1.2.0",
5150
"jscoverage": "^0.6.0",
5251
"lodash": "^4.17.4",
5352
"mocha": "^3.3.0",

src/mixins/validatable-http-message.coffee

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
jsonlint = require 'jsonlint'
21
mediaTyper = require 'media-typer'
32
validators = require '../validators'
43

@@ -138,7 +137,7 @@ class Validatable
138137
contentType = @headers?['content-type']
139138
if @isJsonContentType contentType
140139
try
141-
jsonlint.parse @body
140+
JSON.parse @body
142141
@validation.body.realType = contentType
143142
catch error
144143
message = {
@@ -187,7 +186,7 @@ class Validatable
187186

188187
if @isJsonContentType expectedContentType
189188
try
190-
jsonlint.parse @expected.body
189+
JSON.parse @expected.body
191190
@validation.body.expectedType = expectedContentType
192191
catch error
193192
message = {

test/unit/mixins/validatable-http-message-test.coffee

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -548,13 +548,13 @@ describe "Http validatable mixin", () ->
548548

549549
assert.include results, 'error'
550550

551-
it 'should add error message with lint result', () ->
552-
expected = "Parse error on line 1:\n...\"creative?\": false, 'creativ': true }\n-----------------------^\nExpecting 'STRING', got 'undefined'"
551+
it 'should add error message', () ->
552+
expected = /(Unexpected token ' in JSON at position 21|JSON Parse error: Single quotes \('\) are not allowed in JSON)/
553553
messages = []
554554
for result in instance.validation.body.results
555555
messages.push result.message
556556

557-
assert.include messages[0], expected
557+
assert.match messages[0], expected
558558

559559
it 'should not overwrite existing errors', () ->
560560
instance.validation.body.results = [
@@ -750,13 +750,13 @@ describe "Http validatable mixin", () ->
750750

751751
assert.include messages[0], 'is not a parseable JSON'
752752

753-
it 'should add error message with lint result', () ->
754-
expected = "Parse error on line 1:\n...\"creative?\": false, 'creativ': true }\n-----------------------^\nExpecting 'STRING', got 'undefined'"
753+
it 'should add error message', () ->
754+
expected = /(Unexpected token ' in JSON at position 21|JSON Parse error: Single quotes \('\) are not allowed in JSON)/
755755
messages = []
756756
for result in instance.validation.body.results
757757
messages.push result.message
758758

759-
assert.include messages[0], expected
759+
assert.match messages[0], expected
760760

761761
describe 'expected headers have not content-type application/json', () ->
762762
describe 'expected body is a parseable JSON', () ->

0 commit comments

Comments
 (0)