-
-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate EDF Tempo widget to RTE API (#2114)
- Loading branch information
1 parent
303fee7
commit 344b601
Showing
9 changed files
with
85 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @description Get edf tempo. | ||
* @returns {Promise} Resolve data from RTE. | ||
* @example | ||
* const data = await getEdfTempo(); | ||
*/ | ||
async function getEdfTempo() { | ||
const systemInfos = await this.system.getInfos(); | ||
return this.gladysGatewayClient.getEdfTempo(systemInfos.gladys_version); | ||
} | ||
|
||
module.exports = { | ||
getEdfTempo, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const { expect } = require('chai'); | ||
const { fake } = require('sinon'); | ||
const proxyquire = require('proxyquire').noCallThru(); | ||
const EventEmitter = require('events'); | ||
const GladysGatewayClientMock = require('./GladysGatewayClientMock.test'); | ||
|
||
const event = new EventEmitter(); | ||
|
||
const Gateway = proxyquire('../../../lib/gateway', { | ||
'@gladysassistant/gladys-gateway-js': GladysGatewayClientMock, | ||
}); | ||
|
||
const job = { | ||
wrapper: (type, func) => { | ||
return async () => { | ||
return func(); | ||
}; | ||
}, | ||
updateProgress: fake.resolves({}), | ||
}; | ||
|
||
describe('gateway.getEdfTempo', () => { | ||
const variable = { | ||
getValue: fake.resolves(null), | ||
setValue: fake.resolves(null), | ||
}; | ||
const system = { | ||
getInfos: fake.resolves({ gladys_version: 'v4.12.2' }), | ||
}; | ||
const gateway = new Gateway(variable, event, system, {}, {}, {}, {}, {}, job); | ||
it('should return edf tempo', async () => { | ||
const data = await gateway.getEdfTempo(); | ||
expect(data).to.deep.equal({ today: 'blue', tomorrow: 'unknown' }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters