Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
backbone-adapter-javascript
Commits
b9dfcc49
Unverified
Commit
b9dfcc49
authored
2 years ago
by
Dan Jones
Browse files
Options
Download
Email Patches
Plain Diff
fix: linting
parent
a8e98ce4
Changes
36
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
187 additions
and
147 deletions
+187
-147
test/cucumber/adapter/get-authorization-header.steps.js
test/cucumber/adapter/get-authorization-header.steps.js
+12
-9
test/cucumber/adapter/poll.steps.js
test/cucumber/adapter/poll.steps.js
+43
-34
test/cucumber/adapter/publish.steps.js
test/cucumber/adapter/publish.steps.js
+21
-20
test/cucumber/adapter/token-valid.steps.js
test/cucumber/adapter/token-valid.steps.js
+8
-8
test/cucumber/adapter/validate.steps.js
test/cucumber/adapter/validate.steps.js
+5
-6
test/cucumber/protocol/common.steps.js
test/cucumber/protocol/common.steps.js
+2
-2
test/cucumber/protocol/decode.steps.js
test/cucumber/protocol/decode.steps.js
+2
-2
test/cucumber/protocol/encode.steps.js
test/cucumber/protocol/encode.steps.js
+2
-2
test/cucumber/protocol/get-type.steps.js
test/cucumber/protocol/get-type.steps.js
+8
-5
test/cucumber/protocol/validate.steps.js
test/cucumber/protocol/validate.steps.js
+4
-4
test/cucumber/schema/validate.steps.js
test/cucumber/schema/validate.steps.js
+6
-6
test/fixtures/server.js
test/fixtures/server.js
+6
-4
test/mock/messages/Message_VehicleMission.json
test/mock/messages/Message_VehicleMission.json
+1
-1
test/mock/messages/Message_VehicleStatus.json
test/mock/messages/Message_VehicleStatus.json
+1
-1
test/mock/swagger.json
test/mock/swagger.json
+21
-4
yarn.lock
yarn.lock
+45
-39
No files found.
test/cucumber/adapter/get-authorization-header.steps.js
View file @
b9dfcc49
const
assert
=
require
(
'
assert
'
);
const
assert
=
require
(
'
assert
'
);
const
{
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
When
(
'
the getAuthorizationHeader method is called
'
,
function
()
{
When
(
'
the getAuthorizationHeader method is called
'
,
function
()
{
this
.
call
=
this
.
adapter
.
getAuthorizationHeader
();
this
.
call
=
this
.
adapter
.
getAuthorizationHeader
();
let
callCount
=
this
.
adapter
.
getTrackedCalls
(
'
getAuthorizationHeader
'
).
length
;
let
callCount
=
this
.
adapter
.
getTrackedCalls
(
'
getAuthorizationHeader
'
).
length
;
this
.
callCounts
.
getAuthorizationHeader
=
callCount
;
this
.
callCounts
.
getAuthorizationHeader
=
callCount
;
});
});
Then
(
'
a headers object is returned containing a bearer token authorization header
'
,
function
()
{
Then
(
this
.
call
.
then
(
headers
=>
{
'
a headers object is returned containing a bearer token authorization header
'
,
assert
.
ok
(
'
Authorization
'
in
headers
);
function
()
{
const
authHeaderWords
=
headers
.
Authorization
.
split
(
"
"
);
this
.
call
.
then
((
headers
)
=>
{
assert
.
ok
(
authHeaderWords
[
0
]
===
'
Bearer
'
);
assert
.
ok
(
'
Authorization
'
in
headers
);
assert
.
ok
(
authHeaderWords
[
1
]
===
this
.
adapter
.
credentials
.
token
);
const
authHeaderWords
=
headers
.
Authorization
.
split
(
'
'
);
});
assert
.
ok
(
authHeaderWords
[
0
]
===
'
Bearer
'
);
});
assert
.
ok
(
authHeaderWords
[
1
]
===
this
.
adapter
.
credentials
.
token
);
});
}
);
This diff is collapsed.
Click to expand it.
test/cucumber/adapter/poll.steps.js
View file @
b9dfcc49
...
@@ -5,64 +5,73 @@ const { fixtures } = require('../../fixtures/server');
...
@@ -5,64 +5,73 @@ const { fixtures } = require('../../fixtures/server');
const
mockValidConfig
=
fixtures
.
get
(
'
config-valid
'
);
const
mockValidConfig
=
fixtures
.
get
(
'
config-valid
'
);
const
xMessageResponse
=
function
(
xMessages
)
{
const
xMessageResponse
=
function
(
xMessages
)
{
const
message
=
fixtures
.
get
(
'
message-vehicle-status
'
);
const
message
=
fixtures
.
get
(
'
message-vehicle-status
'
);
let
response
=
[];
let
response
=
[];
for
(
let
i
=
0
;
i
<
xMessages
;
i
++
)
{
for
(
let
i
=
0
;
i
<
xMessages
;
i
++
)
{
response
.
push
({
response
.
push
({
topic
:
"
broadcast
"
,
topic
:
'
broadcast
'
,
message
:
JSON
.
stringify
(
message
)
message
:
JSON
.
stringify
(
message
)
,
});
});
}
}
return
response
;
return
response
;
};
};
When
(
'
a mock receive API response is configured to return {int} messages
'
,
function
(
xMessages
)
{
When
(
const
response
=
xMessageResponse
(
xMessages
);
'
a mock receive API response is configured to return {int} messages
'
,
this
.
mockAxios
.
onGet
(
function
(
xMessages
)
{
`
${
mockValidConfig
.
api
}
/receive`
,
const
response
=
xMessageResponse
(
xMessages
);
).
reply
(
200
,
response
);
this
.
mockAxios
.
onGet
(
`
${
mockValidConfig
.
api
}
/receive`
).
reply
(
200
,
response
);
});
}
);
When
(
'
a mock receive API response is configured to return a {int} error
'
,
function
(
statusCode
)
{
When
(
const
statusMessages
=
{
'
a mock receive API response is configured to return a {int} error
'
,
403
:
'
Token expired
'
,
function
(
statusCode
)
{
503
:
'
Service unavailable
'
const
statusMessages
=
{
};
403
:
'
Token expired
'
,
this
.
mockAxios
.
onGet
(
503
:
'
Service unavailable
'
,
`
${
mockValidConfig
.
api
}
/receive`
,
};
).
reply
(
statusCode
,
{
message
:
statusMessages
[
statusCode
]
})
this
.
mockAxios
});
.
onGet
(
`
${
mockValidConfig
.
api
}
/receive`
)
.
reply
(
statusCode
,
{
message
:
statusMessages
[
statusCode
]
});
}
);
When
(
'
the poll method is called
'
,
function
()
{
When
(
'
the poll method is called
'
,
function
()
{
this
.
call
=
this
.
adapter
.
poll
();
this
.
call
=
this
.
adapter
.
poll
();
this
.
callCounts
.
poll
=
this
.
adapter
.
getTrackedCalls
(
'
poll
'
).
length
;
this
.
callCounts
.
poll
=
this
.
adapter
.
getTrackedCalls
(
'
poll
'
).
length
;
});
});
Then
(
'
a successful response is returned with {int} messages
'
,
function
(
xMessages
)
{
Then
(
this
.
call
'
a successful response is returned with {int} messages
'
,
.
then
(
response
=>
{
function
(
xMessages
)
{
assert
.
equal
(
response
.
data
.
length
,
xMessages
);
this
.
call
.
then
((
response
)
=>
{
});
assert
.
equal
(
response
.
data
.
length
,
xMessages
);
});
});
}
);
Then
(
'
the protocol {string} method is called {int} times
'
,
function
(
method
,
xInvokes
)
{
Then
(
const
decodes
=
this
.
protocol
.
getTrackedCalls
(
method
);
'
the protocol {string} method is called {int} times
'
,
assert
.
equal
(
decodes
.
length
,
xInvokes
);
function
(
method
,
xInvokes
)
{
});
const
decodes
=
this
.
protocol
.
getTrackedCalls
(
method
);
assert
.
equal
(
decodes
.
length
,
xInvokes
);
}
);
When
(
'
the poll method is called with is_retry on
'
,
function
()
{
When
(
'
the poll method is called with is_retry on
'
,
function
()
{
this
.
call
=
this
.
adapter
.
poll
(
true
);
this
.
call
=
this
.
adapter
.
poll
(
true
);
this
.
callCounts
.
poll
=
this
.
adapter
.
getTrackedCalls
(
'
poll
'
).
length
;
this
.
callCounts
.
poll
=
this
.
adapter
.
getTrackedCalls
(
'
poll
'
).
length
;
});
});
Then
(
'
the poll method was called with is_retry on
'
,
function
()
{
Then
(
'
the poll method was called with is_retry on
'
,
function
()
{
let
pollCalls
=
this
.
adapter
.
getTrackedCalls
(
'
poll
'
);
let
pollCalls
=
this
.
adapter
.
getTrackedCalls
(
'
poll
'
);
let
lastCall
=
pollCalls
[
pollCalls
.
length
-
1
];
let
lastCall
=
pollCalls
[
pollCalls
.
length
-
1
];
assert
.
ok
(
lastCall
.
arguments
[
1
].
is_retry
);
assert
.
ok
(
lastCall
.
arguments
[
1
].
is_retry
);
});
});
Then
(
'
the poll method is not called again
'
,
function
()
{
Then
(
'
the poll method is not called again
'
,
function
()
{
let
newPollCallCount
=
this
.
adapter
.
getTrackedCalls
(
'
poll
'
).
length
;
let
newPollCallCount
=
this
.
adapter
.
getTrackedCalls
(
'
poll
'
).
length
;
assert
.
equal
(
this
.
callCounts
.
poll
,
newPollCallCount
);
assert
.
equal
(
this
.
callCounts
.
poll
,
newPollCallCount
);
});
});
This diff is collapsed.
Click to expand it.
test/cucumber/adapter/publish.steps.js
View file @
b9dfcc49
...
@@ -5,24 +5,25 @@ const { fixtures } = require('../../fixtures/server');
...
@@ -5,24 +5,25 @@ const { fixtures } = require('../../fixtures/server');
const
mockValidConfig
=
fixtures
.
get
(
'
config-valid
'
);
const
mockValidConfig
=
fixtures
.
get
(
'
config-valid
'
);
When
(
'
a mock send API response is configured to return success
'
,
function
()
{
When
(
'
a mock send API response is configured to return success
'
,
function
()
{
const
response
=
{};
const
response
=
{};
this
.
mockAxios
.
onPost
(
this
.
mockAxios
.
onPost
(
`
${
mockValidConfig
.
api
}
/send`
).
reply
(
200
,
response
);
`
${
mockValidConfig
.
api
}
/send`
,
).
reply
(
200
,
response
);
});
});
When
(
'
a mock send API response is configured to return a {int} error
'
,
function
(
statusCode
)
{
When
(
const
statusMessages
=
{
'
a mock send API response is configured to return a {int} error
'
,
403
:
'
Token expired
'
,
function
(
statusCode
)
{
503
:
'
Service unavailable
'
const
statusMessages
=
{
};
403
:
'
Token expired
'
,
this
.
mockAxios
.
onPost
(
503
:
'
Service unavailable
'
,
`
${
mockValidConfig
.
api
}
/send`
,
};
).
reply
(
statusCode
,
{
message
:
statusMessages
[
statusCode
]
})
this
.
mockAxios
});
.
onPost
(
`
${
mockValidConfig
.
api
}
/send`
)
.
reply
(
statusCode
,
{
message
:
statusMessages
[
statusCode
]
});
When
(
'
the publish method is called
'
,
function
()
{
}
);
When
(
'
the publish method is called
'
,
function
()
{
const
message
=
fixtures
.
get
(
'
message-vehicle-status
'
);
const
message
=
fixtures
.
get
(
'
message-vehicle-status
'
);
this
.
message
=
message
;
this
.
message
=
message
;
const
topic
=
message
.
metadata
.
destination
;
const
topic
=
message
.
metadata
.
destination
;
...
@@ -31,7 +32,7 @@ When('the publish method is called', function() {
...
@@ -31,7 +32,7 @@ When('the publish method is called', function() {
this
.
callCounts
.
publish
=
this
.
adapter
.
getTrackedCalls
(
'
publish
'
).
length
;
this
.
callCounts
.
publish
=
this
.
adapter
.
getTrackedCalls
(
'
publish
'
).
length
;
});
});
When
(
'
the publish method is called with is_retry on
'
,
function
()
{
When
(
'
the publish method is called with is_retry on
'
,
function
()
{
const
message
=
fixtures
.
get
(
'
message-vehicle-status
'
);
const
message
=
fixtures
.
get
(
'
message-vehicle-status
'
);
this
.
message
=
message
;
this
.
message
=
message
;
const
topic
=
message
.
metadata
.
destination
;
const
topic
=
message
.
metadata
.
destination
;
...
@@ -40,13 +41,13 @@ When('the publish method is called with is_retry on', function() {
...
@@ -40,13 +41,13 @@ When('the publish method is called with is_retry on', function() {
this
.
callCounts
.
publish
=
this
.
adapter
.
getTrackedCalls
(
'
publish
'
).
length
;
this
.
callCounts
.
publish
=
this
.
adapter
.
getTrackedCalls
(
'
publish
'
).
length
;
});
});
Then
(
'
the publish method was called with is_retry on
'
,
function
()
{
Then
(
'
the publish method was called with is_retry on
'
,
function
()
{
let
publishCalls
=
this
.
adapter
.
getTrackedCalls
(
'
publish
'
);
let
publishCalls
=
this
.
adapter
.
getTrackedCalls
(
'
publish
'
);
let
lastCall
=
publishCalls
[
publishCalls
.
length
-
1
];
let
lastCall
=
publishCalls
[
publishCalls
.
length
-
1
];
assert
.
ok
(
lastCall
.
arguments
[
1
].
is_retry
);
assert
.
ok
(
lastCall
.
arguments
[
1
].
is_retry
);
});
});
Then
(
'
the publish method is not called again
'
,
function
()
{
Then
(
'
the publish method is not called again
'
,
function
()
{
let
newPublishCallCount
=
this
.
adapter
.
getTrackedCalls
(
'
publish
'
).
length
;
let
newPublishCallCount
=
this
.
adapter
.
getTrackedCalls
(
'
publish
'
).
length
;
assert
.
equal
(
this
.
callCounts
.
publish
,
newPublishCallCount
);
assert
.
equal
(
this
.
callCounts
.
publish
,
newPublishCallCount
);
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/cucumber/adapter/token-valid.steps.js
View file @
b9dfcc49
const
assert
=
require
(
'
assert
'
);
const
assert
=
require
(
'
assert
'
);
const
{
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
When
(
'
the token expiry is in the future
'
,
function
()
{
When
(
'
the token expiry is in the future
'
,
function
()
{
const
expiry
=
new
Date
();
const
expiry
=
new
Date
();
expiry
.
setHours
(
expiry
.
getHours
()
+
1
);
expiry
.
setHours
(
expiry
.
getHours
()
+
1
);
this
.
adapter
.
credentials
.
expiry
=
expiry
.
toISOString
();
this
.
adapter
.
credentials
.
expiry
=
expiry
.
toISOString
();
});
});
When
(
'
the token expiry is in the past
'
,
function
()
{
When
(
'
the token expiry is in the past
'
,
function
()
{
const
expiry
=
new
Date
();
const
expiry
=
new
Date
();
expiry
.
setHours
(
expiry
.
getHours
()
-
1
);
expiry
.
setHours
(
expiry
.
getHours
()
-
1
);
this
.
adapter
.
credentials
.
expiry
=
expiry
.
toISOString
();
this
.
adapter
.
credentials
.
expiry
=
expiry
.
toISOString
();
});
});
// Boolean parameters are not supported
// Boolean parameters are not supported
// and returns "true" would be misleading
// and returns "true" would be misleading
Then
(
'
tokenValid returns true
'
,
function
()
{
Then
(
'
tokenValid returns true
'
,
function
()
{
const
isValid
=
this
.
adapter
.
tokenValid
();
const
isValid
=
this
.
adapter
.
tokenValid
();
assert
.
ok
(
isValid
);
assert
.
ok
(
isValid
);
});
});
Then
(
'
tokenValid returns false
'
,
function
()
{
Then
(
'
tokenValid returns false
'
,
function
()
{
const
isValid
=
this
.
adapter
.
tokenValid
();
const
isValid
=
this
.
adapter
.
tokenValid
();
assert
.
ok
(
!
isValid
);
assert
.
ok
(
!
isValid
);
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/cucumber/adapter/validate.steps.js
View file @
b9dfcc49
const
assert
=
require
(
'
assert
'
);
const
{
Given
,
When
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
Given
,
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
fixtures
}
=
require
(
'
../../fixtures/server
'
);
const
{
fixtures
}
=
require
(
'
../../fixtures/server
'
);
Given
(
'
a valid message
'
,
function
()
{
Given
(
'
a valid message
'
,
function
()
{
this
.
message
=
fixtures
.
get
(
'
message-vehicle-status
'
);
this
.
message
=
fixtures
.
get
(
'
message-vehicle-status
'
);
});
});
Given
(
'
an invalid message
'
,
function
()
{
Given
(
'
an invalid message
'
,
function
()
{
this
.
message
=
fixtures
.
get
(
'
message-vehicle-status-invalid
'
);
this
.
message
=
fixtures
.
get
(
'
message-vehicle-status-invalid
'
);
});
});
When
(
'
the validate method is called
'
,
function
()
{
When
(
'
the validate method is called
'
,
function
()
{
this
.
validation
=
this
.
adapter
.
validate
(
this
.
message
);
this
.
validation
=
this
.
adapter
.
validate
(
this
.
message
);
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/cucumber/protocol/common.steps.js
View file @
b9dfcc49
const
assert
=
require
(
'
assert
'
);
const
assert
=
require
(
'
assert
'
);
const
{
Then
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
Then
}
=
require
(
'
@cucumber/cucumber
'
);
Then
(
'
the message is returned unaltered
'
,
function
()
{
Then
(
'
the message is returned unaltered
'
,
function
()
{
assert
.
equal
(
this
.
message
,
this
.
response
);
assert
.
equal
(
this
.
message
,
this
.
response
);
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/cucumber/protocol/decode.steps.js
View file @
b9dfcc49
const
{
When
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
When
}
=
require
(
'
@cucumber/cucumber
'
);
When
(
'
the protocol.decode method is called
'
,
function
()
{
When
(
'
the protocol.decode method is called
'
,
function
()
{
const
type
=
this
.
protocol
.
getType
(
this
.
message
);
const
type
=
this
.
protocol
.
getType
(
this
.
message
);
this
.
response
=
this
.
protocol
.
decode
(
type
,
this
.
message
);
this
.
response
=
this
.
protocol
.
decode
(
type
,
this
.
message
);
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/cucumber/protocol/encode.steps.js
View file @
b9dfcc49
const
{
When
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
When
}
=
require
(
'
@cucumber/cucumber
'
);
When
(
'
the protocol.encode method is called
'
,
function
()
{
When
(
'
the protocol.encode method is called
'
,
function
()
{
const
type
=
this
.
protocol
.
getType
(
this
.
message
);
const
type
=
this
.
protocol
.
getType
(
this
.
message
);
this
.
response
=
this
.
protocol
.
encode
(
type
,
this
.
message
);
this
.
response
=
this
.
protocol
.
encode
(
type
,
this
.
message
);
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/cucumber/protocol/get-type.steps.js
View file @
b9dfcc49
const
assert
=
require
(
'
assert
'
);
const
assert
=
require
(
'
assert
'
);
const
{
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
When
(
'
protocol getType is called
'
,
function
()
{
When
(
'
protocol getType is called
'
,
function
()
{
this
.
type
=
this
.
protocol
.
getType
(
this
.
message
);
this
.
type
=
this
.
protocol
.
getType
(
this
.
message
);
});
});
Then
(
'
getType returns message.payload.message_type if present
'
,
function
()
{
Then
(
'
getType returns message.payload.message_type if present
'
,
function
()
{
assert
.
equal
(
this
.
type
,
this
.
message
.
payload
.
message_type
);
assert
.
equal
(
this
.
type
,
this
.
message
.
payload
.
message_type
);
});
});
Then
(
'
getType returns null if message.payload.message_type is not present
'
,
function
()
{
Then
(
assert
.
equal
(
this
.
type
,
null
);
'
getType returns null if message.payload.message_type is not present
'
,
});
function
()
{
\ No newline at end of file
assert
.
equal
(
this
.
type
,
null
);
}
);
This diff is collapsed.
Click to expand it.
test/cucumber/protocol/validate.steps.js
View file @
b9dfcc49
const
assert
=
require
(
'
assert
'
);
const
assert
=
require
(
'
assert
'
);
const
{
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
When
(
'
the protocol.validate method is called
'
,
function
()
{
When
(
'
the protocol.validate method is called
'
,
function
()
{
this
.
validation
=
this
.
protocol
.
validate
(
this
.
message
);
this
.
validation
=
this
.
protocol
.
validate
(
this
.
message
);
});
});
Then
(
'
the message is validated successfully
'
,
function
()
{
Then
(
'
the message is validated successfully
'
,
function
()
{
assert
.
equal
(
this
.
validation
.
valid
,
true
);
assert
.
equal
(
this
.
validation
.
valid
,
true
);
assert
.
equal
(
this
.
validation
.
errorCount
,
0
);
assert
.
equal
(
this
.
validation
.
errorCount
,
0
);
});
});
Then
(
'
the message fails to validate
'
,
function
()
{
Then
(
'
the message fails to validate
'
,
function
()
{
assert
.
equal
(
this
.
validation
.
valid
,
false
);
assert
.
equal
(
this
.
validation
.
valid
,
false
);
assert
.
notEqual
(
this
.
validation
.
errorCount
,
0
);
assert
.
notEqual
(
this
.
validation
.
errorCount
,
0
);
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/cucumber/schema/validate.steps.js
View file @
b9dfcc49
...
@@ -6,18 +6,18 @@ const fs = require('fs');
...
@@ -6,18 +6,18 @@ const fs = require('fs');
const
schemaLocation
=
'
./test/mock/swagger.json
'
;
const
schemaLocation
=
'
./test/mock/swagger.json
'
;
Given
(
'
the test schema
'
,
function
()
{
Given
(
'
the test schema
'
,
function
()
{
this
.
schema
=
JSON
.
parse
(
fs
.
readFileSync
(
schemaLocation
));
this
.
schema
=
JSON
.
parse
(
fs
.
readFileSync
(
schemaLocation
));
});
});
When
(
'
it is validated
'
,
function
()
{
When
(
'
it is validated
'
,
function
()
{
const
validator
=
new
OpenAPISchemaValidator
({
version
:
3
});
const
validator
=
new
OpenAPISchemaValidator
({
version
:
3
});
this
.
validation
=
validator
.
validate
(
this
.
schema
);
this
.
validation
=
validator
.
validate
(
this
.
schema
);
});
});
Then
(
'
it matches the OpenAPI specification
'
,
function
()
{
Then
(
'
it matches the OpenAPI specification
'
,
function
()
{
// According to the docs this should return a valid:boolean
// According to the docs this should return a valid:boolean
// but if you look at the code it just returns a list of errors
// but if you look at the code it just returns a list of errors
// which is empty for a valid result
// which is empty for a valid result
assert
.
equal
(
this
.
validation
.
errors
.
length
,
0
);
assert
.
equal
(
this
.
validation
.
errors
.
length
,
0
);
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/fixtures/server.js
View file @
b9dfcc49
...
@@ -4,12 +4,14 @@ const path = require('path');
...
@@ -4,12 +4,14 @@ const path = require('path');
exports
.
fixtures
=
{
exports
.
fixtures
=
{
get
:
function
(
fixtureName
)
{
get
:
function
(
fixtureName
)
{
try
{
try
{
let
fixtureContent
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
`
${
fixtureName
}
.json`
));
let
fixtureContent
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
`
${
fixtureName
}
.json`
)
);
let
fixture
=
JSON
.
parse
(
fixtureContent
);
let
fixture
=
JSON
.
parse
(
fixtureContent
);
return
fixture
;
return
fixture
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
'
Fixture not found
'
,
fixtureName
);
console
.
error
(
'
Fixture not found
'
,
fixtureName
);
return
null
;
return
null
;
}
}
}
},
}
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/mock/messages/Message_VehicleMission.json
View file @
b9dfcc49
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
"longitude"
:
-10.432
,
"longitude"
:
-10.432
,
"depth"
:
50
,
"depth"
:
50
,
"projection"
:
4326
"projection"
:
4326
},
},
"actions"
:
[]
"actions"
:
[]
}
}
}
}
This diff is collapsed.
Click to expand it.
test/mock/messages/Message_VehicleStatus.json
View file @
b9dfcc49
...
@@ -17,4 +17,4 @@
...
@@ -17,4 +17,4 @@
},
},
"battery_percentage"
:
64
"battery_percentage"
:
64
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/mock/swagger.json
View file @
b9dfcc49
...
@@ -64,7 +64,7 @@
...
@@ -64,7 +64,7 @@
"example"
:
"VehicleStatus"
"example"
:
"VehicleStatus"
}
}
},
},
"required"
:
[
"source"
,
"destination"
,
"message_id"
],
"required"
:
[
"source"
,
"destination"
,
"message_id"
],
"type"
:
"object"
"type"
:
"object"
},
},
"Coordinates"
:
{
"Coordinates"
:
{
...
@@ -128,7 +128,13 @@
...
@@ -128,7 +128,13 @@
"example"
:
64
"example"
:
64
}
}
},
},
"required"
:
[
"message_type"
,
"operator_id"
,
"vehicle_id"
,
"coordinates"
,
"battery_percentage"
],
"required"
:
[
"message_type"
,
"operator_id"
,
"vehicle_id"
,
"coordinates"
,
"battery_percentage"
],
"type"
:
"object"
"type"
:
"object"
},
},
"VehicleMission"
:
{
"VehicleMission"
:
{
...
@@ -177,7 +183,13 @@
...
@@ -177,7 +183,13 @@
}
}
}
}
},
},
"required"
:
[
"message_type"
,
"operator_id"
,
"vehicle_id"
,
"coordinates"
,
"actions"
],
"required"
:
[
"message_type"
,
"operator_id"
,
"vehicle_id"
,
"coordinates"
,
"actions"
],
"type"
:
"object"
"type"
:
"object"
},
},
"AreaOfInterest"
:
{
"AreaOfInterest"
:
{
...
@@ -202,7 +214,12 @@
...
@@ -202,7 +214,12 @@
"$ref"
:
"#/components/schemas/Coordinates"
"$ref"
:
"#/components/schemas/Coordinates"
}
}
},
},
"required"
:
[
"message_type"
,
"operator_id"
,
"vehicle_id"
,
"coordinates"
],
"required"
:
[
"message_type"
,
"operator_id"
,
"vehicle_id"
,
"coordinates"
],
"type"
:
"object"
"type"
:
"object"
},
},
"GoToWaypoint"
:
{
"GoToWaypoint"
:
{
...
...
This diff is collapsed.
Click to expand it.
yarn.lock
View file @
b9dfcc49
...
@@ -581,14 +581,26 @@
...
@@ -581,14 +581,26 @@
ts-node "^9"
ts-node "^9"
tslib "^2"
tslib "^2"
"@eslint/eslintrc@^1.4.1":
"@eslint-community/eslint-utils@^4.2.0":
version "1.4.1"
version "4.3.0"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.4.1.tgz#af58772019a2d271b7e2d4c23ff4ddcba3ccfb3e"
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.3.0.tgz#a556790523a351b4e47e9d385f47265eaaf9780a"
integrity sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==
integrity sha512-v3oplH6FYCULtFuCeqyuTd9D2WKO937Dxdq+GmHOLL72TTRriLxz2VLlNfkZRsvj6PKnOPAtuT6dwrs/pA5DvA==
dependencies:
eslint-visitor-keys "^3.3.0"
"@eslint-community/regexpp@^4.4.0":
version "4.4.0"
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.4.0.tgz#3e61c564fcd6b921cb789838631c5ee44df09403"
integrity sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==
"@eslint/eslintrc@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.1.tgz#7888fe7ec8f21bc26d646dbd2c11cd776e21192d"
integrity sha512-eFRmABvW2E5Ho6f5fHLqgena46rOj7r7OKHYfLElqcBfGFHHpjBhivyi5+jOEQuSpdc/1phIZJlbC2te+tZNIw==
dependencies:
dependencies:
ajv "^6.12.4"
ajv "^6.12.4"
debug "^4.3.2"
debug "^4.3.2"
espree "^9.
4
.0"
espree "^9.
5
.0"
globals "^13.19.0"
globals "^13.19.0"
ignore "^5.2.0"
ignore "^5.2.0"
import-fresh "^3.2.1"
import-fresh "^3.2.1"
...
@@ -596,6 +608,11 @@
...
@@ -596,6 +608,11 @@
minimatch "^3.1.2"
minimatch "^3.1.2"
strip-json-comments "^3.1.1"
strip-json-comments "^3.1.1"
"@eslint/js@8.36.0":
version "8.36.0"
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.36.0.tgz#9837f768c03a1e4a30bd304a64fb8844f0e72efe"
integrity sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg==
"@humanwhocodes/config-array@^0.11.8":
"@humanwhocodes/config-array@^0.11.8":
version "0.11.8"
version "0.11.8"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9"
...
@@ -1898,14 +1915,7 @@ eslint-scope@^7.1.1:
...
@@ -1898,14 +1915,7 @@ eslint-scope@^7.1.1:
esrecurse "^4.3.0"
esrecurse "^4.3.0"
estraverse "^5.2.0"
estraverse "^5.2.0"
eslint-utils@^3.0.0:
eslint-visitor-keys@^2.1.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672"
integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==
dependencies:
eslint-visitor-keys "^2.0.0"
eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0:
version "2.1.0"
version "2.1.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==
integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==
...
@@ -1915,12 +1925,15 @@ eslint-visitor-keys@^3.3.0:
...
@@ -1915,12 +1925,15 @@ eslint-visitor-keys@^3.3.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826"
integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==
integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==
eslint@^8.
4.1
:
eslint@^8.
36.0
:
version "8.3
1
.0"
version "8.3
6
.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.3
1
.0.tgz#
75028e77cbcff102a9feae1d718135931532d524
"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.3
6
.0.tgz#
1bd72202200a5492f91803b113fb8a83b11285cf
"
integrity sha512-
0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA
==
integrity sha512-
Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw
==
dependencies:
dependencies:
"@eslint/eslintrc" "^1.4.1"
"@eslint-community/eslint-utils" "^4.2.0"
"@eslint-community/regexpp" "^4.4.0"
"@eslint/eslintrc" "^2.0.1"
"@eslint/js" "8.36.0"
"@humanwhocodes/config-array" "^0.11.8"
"@humanwhocodes/config-array" "^0.11.8"
"@humanwhocodes/module-importer" "^1.0.1"
"@humanwhocodes/module-importer" "^1.0.1"
"@nodelib/fs.walk" "^1.2.8"
"@nodelib/fs.walk" "^1.2.8"
...
@@ -1931,10 +1944,9 @@ eslint@^8.4.1:
...
@@ -1931,10 +1944,9 @@ eslint@^8.4.1:
doctrine "^3.0.0"
doctrine "^3.0.0"
escape-string-regexp "^4.0.0"
escape-string-regexp "^4.0.0"
eslint-scope "^7.1.1"
eslint-scope "^7.1.1"
eslint-utils "^3.0.0"
eslint-visitor-keys "^3.3.0"
eslint-visitor-keys "^3.3.0"
espree "^9.
4
.0"
espree "^9.
5
.0"
esquery "^1.4.
0
"
esquery "^1.4.
2
"
esutils "^2.0.2"
esutils "^2.0.2"
fast-deep-equal "^3.1.3"
fast-deep-equal "^3.1.3"
file-entry-cache "^6.0.1"
file-entry-cache "^6.0.1"
...
@@ -1955,15 +1967,14 @@ eslint@^8.4.1:
...
@@ -1955,15 +1967,14 @@ eslint@^8.4.1:
minimatch "^3.1.2"
minimatch "^3.1.2"
natural-compare "^1.4.0"
natural-compare "^1.4.0"
optionator "^0.9.1"
optionator "^0.9.1"
regexpp "^3.2.0"
strip-ansi "^6.0.1"
strip-ansi "^6.0.1"
strip-json-comments "^3.1.0"
strip-json-comments "^3.1.0"
text-table "^0.2.0"
text-table "^0.2.0"
espree@^9.
4
.0:
espree@^9.
5
.0:
version "9.
4.1
"
version "9.
5.0
"
resolved "https://registry.yarnpkg.com/espree/-/espree-9.
4.1
.tgz#
51d6092615567a2c2cff7833445e37c28c0065bd
"
resolved "https://registry.yarnpkg.com/espree/-/espree-9.
5.0
.tgz#
3646d4e3f58907464edba852fa047e6a27bdf113
"
integrity sha512-
XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg
==
integrity sha512-
JPbJGhKc47++oo4JkEoTe2wjy4fmMwvFpgJT9cQzmfXKp22Dr6Hf1tdCteLz1h0P3t+mGvWZ+4Uankvh8+c6zw
==
dependencies:
dependencies:
acorn "^8.8.0"
acorn "^8.8.0"
acorn-jsx "^5.3.2"
acorn-jsx "^5.3.2"
...
@@ -1974,10 +1985,10 @@ esprima@^4.0.0, esprima@^4.0.1:
...
@@ -1974,10 +1985,10 @@ esprima@^4.0.0, esprima@^4.0.1:
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
esquery@^1.4.
0
:
esquery@^1.4.
2
:
version "1.
4
.0"
version "1.
5
.0"
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.
4
.0.tgz#
2148ffc38b82e8c7057dfed48425b3e61f0f24a5
"
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.
5
.0.tgz#
6ce17738de8577694edd7361c57182ac8cb0db0b
"
integrity sha512-
cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w
==
integrity sha512-
YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg
==
dependencies:
dependencies:
estraverse "^5.1.0"
estraverse "^5.1.0"
...
@@ -3720,10 +3731,10 @@ prettier-linter-helpers@^1.0.0:
...
@@ -3720,10 +3731,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
dependencies:
fast-diff "^1.1.2"
fast-diff "^1.1.2"
prettier@^2.
5.1
:
prettier@^2.
8.4
:
version "2.8.
2
"
version "2.8.
4
"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.
2
.tgz#
c4ea1b5b454d7c4b59966db2e06ed7eec5dfd160
"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.
4
.tgz#
34dd2595629bfbb79d344ac4a91ff948694463c3
"
integrity sha512-
BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfp
w==
integrity sha512-
vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZdd
w==
pretty-format@^27.5.1:
pretty-format@^27.5.1:
version "27.5.1"
version "27.5.1"
...
@@ -3905,11 +3916,6 @@ regexp-tree@^0.1.11:
...
@@ -3905,11 +3916,6 @@ regexp-tree@^0.1.11:
resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.24.tgz#3d6fa238450a4d66e5bc9c4c14bb720e2196829d"
resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.24.tgz#3d6fa238450a4d66e5bc9c4c14bb720e2196829d"
integrity sha512-s2aEVuLhvnVJW6s/iPgEGK6R+/xngd2jNQ+xy4bXNDKxZKJH6jpPHY6kVeVv1IeLCHgswRj+Kl3ELaDjG6V1iw==
integrity sha512-s2aEVuLhvnVJW6s/iPgEGK6R+/xngd2jNQ+xy4bXNDKxZKJH6jpPHY6kVeVv1IeLCHgswRj+Kl3ELaDjG6V1iw==
regexpp@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2"
integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==
repeat-string@^1.5.2, repeat-string@^1.6.1:
repeat-string@^1.5.2, repeat-string@^1.6.1:
version "1.6.1"
version "1.6.1"
resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637"
resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637"
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment