Skip to content

Commit

Permalink
feature: add nock lib to be able to test without a running context br…
Browse files Browse the repository at this point in the history
…oker telefonicaid#81

Signed-off-by: Benoit Orihuela <[email protected]>
  • Loading branch information
vraybaud authored and bobeal committed Aug 5, 2020
1 parent a27f41d commit 458922f
Show file tree
Hide file tree
Showing 13 changed files with 362 additions and 182 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ jobs:
node_js: 10

before_install:
- docker pull telefonicaiot/fiware-orion
- docker run --name mongodb -d mongo:3.4
- docker run --name orion -d --link mongodb:mongodb -p 10026:1026 telefonicaiot/fiware-orion -dbhost mongodb

before_script:
- npm run lint
Expand Down
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
- Fix or disable eslint errors
- Set Nodejs 10 as minimum version in packages.json (effectively removing Nodev8 from supported versions)
- Allow to configure id field in received callbacks from Sigfox
- Use nock lib to mock exchanges with a context broker during tests (and avoid depending on a running one)

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"logops": "2.1.0"
},
"devDependencies": {
"nock":"14.4.0",
"coveralls": "~3.0.2",
"husky": "~1.1.0",
"eslint": "~5.16.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"contextElements": [
{
"type": "SIGFOX",
"isPattern": "false",
"id": "sigApp3",
"attributes": [
{
"name": "time",
"type": "String",
"value": "1430909015"
},
{
"name": "statin",
"type": "String",
"value": "0A5F"
},
{
"name": "lng",
"type": "String",
"value": "-4"
},
{
"name": "lat",
"type": "String",
"value": "41"
},
{
"name": "campo1",
"type": "Integer",
"value": "valor1"
},
{
"name": "campo2",
"type": "Integer",
"value": 64
}
]
}
],
"updateAction": "UPDATE"
}
57 changes: 57 additions & 0 deletions test/examples/deviceProvisioning/expectedDataUpdateRequest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"contextElements": [
{
"type": "SIGFOX",
"isPattern": "false",
"id": "sigApp2",
"attributes": [
{
"name": "time",
"type": "String",
"value": "1430909015"
},
{
"name": "statin",
"type": "String",
"value": "0A5F"
},
{
"name": "lng",
"type": "String",
"value": "-4"
},
{
"name": "lat",
"type": "String",
"value": "41"
},
{
"name": "theCounter",
"type": "Integer",
"value": 2
},
{
"name": "theParam1",
"type": "Integer",
"value": 0
},
{
"name": "param2",
"type": "Integer",
"value": 0
},
{
"name": "tempDegreesCelsius",
"type": "Integer",
"value": 35
},
{
"name": "voltage",
"type": "Integer",
"value": 3183
}
]
}
],
"updateAction": "UPDATE"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"contextElements": [
{
"type": "SIGFOX",
"isPattern": "false",
"id": "sigApp3",
"attributes": [
{
"name": "time",
"type": "String",
"value": " "
},
{
"name": "statin",
"type": "String",
"value": " "
},
{
"name": "lng",
"type": "String",
"value": " "
},
{
"name": "lat",
"type": "String",
"value": " "
},
{
"name": "campo1",
"type": "Integer",
"value": " "
},
{
"name": "campo2",
"type": "Integer",
"value": " "
}
]
}
],
"updateAction": "APPEND"
}
57 changes: 57 additions & 0 deletions test/examples/deviceProvisioning/expectedProvisioningRequest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"contextElements": [
{
"type": "SIGFOX",
"isPattern": "false",
"id": "sigApp2",
"attributes": [
{
"name": "time",
"type": "String",
"value": " "
},
{
"name": "statin",
"type": "String",
"value": " "
},
{
"name": "lng",
"type": "String",
"value": " "
},
{
"name": "lat",
"type": "String",
"value": " "
},
{
"name": "theCounter",
"type": "Integer",
"value": " "
},
{
"name": "theParam1",
"type": "Integer",
"value": " "
},
{
"name": "param2",
"type": "Integer",
"value": " "
},
{
"name": "tempDegreesCelsius",
"type": "Integer",
"value": " "
},
{
"name": "voltage",
"type": "Integer",
"value": " "
}
]
}
],
"updateAction": "APPEND"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"contextElements": [
{
"type": "SIGFOX",
"isPattern": "false",
"id": "SIGFOX:sigApp1",
"attributes": [
{
"name": "time",
"type": "String",
"value": " "
},
{
"name": "statin",
"type": "String",
"value": " "
},
{
"name": "lng",
"type": "String",
"value": " "
},
{
"name": "lat",
"type": "String",
"value": " "
},
{
"name": "counter",
"type": "Integer",
"value": " "
},
{
"name": "param1",
"type": "Integer",
"value": " "
},
{
"name": "param2",
"type": "Integer",
"value": " "
},
{
"name": "tempDegreesCelsius",
"type": "Integer",
"value": " "
},
{
"name": "voltage",
"type": "Integer",
"value": " "
}
]
}
],
"updateAction": "APPEND"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"contextElements": [
{
"type": "SIGFOX",
"isPattern": "false",
"id": "SIGFOX:sigApp1",
"attributes": [
{
"name": "time",
"type": "String",
"value": "1430909015"
},
{
"name": "statin",
"type": "String",
"value": "0A5F"
},
{
"name": "lng",
"type": "String",
"value": "-4"
},
{
"name": "lat",
"type": "String",
"value": "41"
},
{
"name": "counter",
"type": "Integer",
"value": 2
},
{
"name": "param1",
"type": "Integer",
"value": 0
},
{
"name": "param2",
"type": "Integer",
"value": 0
},
{
"name": "tempDegreesCelsius",
"type": "Integer",
"value": 35
},
{
"name": "voltage",
"type": "Integer",
"value": 3183
}
]
}
],
"updateAction": "UPDATE"
}
Loading

0 comments on commit 458922f

Please sign in to comment.