Skip to content

Commit

Permalink
Merge branch 'persistence-service' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Tale152 committed Sep 8, 2022
2 parents b0c4cf2 + 8052357 commit e9bcbfb
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 44 deletions.
4 changes: 0 additions & 4 deletions persistence-service/test/airHumidity/get.latest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ test("Retreiving with multiple values for for Air Humidity", async () => {
await latestTests.latestMultipleValues(registerRoute, latestRoute)
})

test("Not existing Settings id for for Air Humidity", async () => {
await latestTests.notExistingId(latestRoute)
})

test("Wrong token for for Air Humidity", async () => {
await latestTests.wrongToken(latestRoute)
})
4 changes: 0 additions & 4 deletions persistence-service/test/airHumidity/get.list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ test("Retreiving correct Air Humidity list", async () => {
await listTests.correctList(registerRoute, listRoute)
})

test("Not existing Settings id for Air Humidity list", async () => {
await listTests.notExistingId(listRoute)
})

test("Wrong token for Air Humidity list", async () => {
await listTests.wrongToken(listRoute)
})
4 changes: 0 additions & 4 deletions persistence-service/test/temperature/get.latest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ test("Retreiving with multiple values for Temperature", async () => {
await latestTests.latestMultipleValues(registerRoute, latestRoute)
})

test("Not existing Settings id for Temperature", async () => {
await latestTests.notExistingId(latestRoute)
})

test("Wrong token for Temperature", async () => {
await latestTests.wrongToken(latestRoute)
})
4 changes: 0 additions & 4 deletions persistence-service/test/temperature/get.list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ test("Retreiving correct Temperature list", async () => {
await listTests.correctList(registerRoute, listRoute)
})

test("Not existing Settings id for Temperature list", async () => {
await listTests.notExistingId(listRoute)
})

test("Wrong token for Temperature list", async () => {
await listTests.wrongToken(listRoute)
})
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,6 @@ module.exports.latestMultipleValues = async function(registerRoute, retreiveRout
)
}

module.exports.notExistingId = async function(retreiveRoute){
await httpTest.get(
server,
retreiveRoute,
{},
values.correctAgentToken,
404,
(res) => {/* does nothing */}
)
}

module.exports.wrongToken = async function(retreiveRoute){
await httpTest.get(
server,
Expand Down
17 changes: 2 additions & 15 deletions persistence-service/test/util/templates/pairTimestampValue/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports.correctList = async function(registerRoute, retreiveRoute){
server,
retreiveRoute,
{
id: values.idEnvironment
id: values.environmentId
},
values.correctFarmerToken,
200,
Expand All @@ -56,25 +56,12 @@ module.exports.correctList = async function(registerRoute, retreiveRoute){
)
}

module.exports.notExistingId = async function(retreiveRoute){
await httpTest.get(
server,
retreiveRoute,
{
id: values.idEnvironment
},
values.correctFarmerToken,
200,
(res) => expect(res.body.list.length).toBe(0)
)
}

module.exports.wrongToken = async function(retreiveRoute){
await httpTest.get(
server,
retreiveRoute,
{
id: values.idEnvironment
id: values.environmentId
},
values.wrongToken,
401,
Expand Down
4 changes: 2 additions & 2 deletions persistence-service/test/util/values.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const jwt = require('jsonwebtoken')

module.exports = {
correctAgentToken: jwt.sign({
idEnvironment: "61c099edd3c873c6030793b7"
environmentId: "61c099edd3c873c6030793b7"
}, require('../../src/conf').agentTokenSecret),
correctFarmerToken: jwt.sign({}, require('../../src/conf').farmerTokenSecret),
wrongToken: jwt.sign({}, "wrong"),
idEnvironment: "61c099edd3c873c6030793b7",
environmentId: "61c099edd3c873c6030793b7",
}

0 comments on commit e9bcbfb

Please sign in to comment.