Skip to content

Commit

Permalink
Version update
Browse files Browse the repository at this point in the history
  • Loading branch information
WoCha-FR committed Nov 20, 2022
1 parent 1ef18b4 commit f04fc0d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 23 deletions.
7 changes: 4 additions & 3 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,24 @@ const config = yargs
.describe('t', 'mqtt topic prefix')
.describe('v', 'log verbosity')
.describe('s', 'allow ssl connections with invalid certs')
.describe('z', 'log with no color')
.alias({
a: 'ville',
u: 'mqttUrl',
t: 'mqttTopic',
v: 'logVerbosity',
s: 'sslVerify',
h: 'help'
z: 'noColor'
})
.array('ville')
.boolean('ssl-verify')
.boolean(['sslVerify', 'NoColor'])
.choices('v', ['error', 'warn', 'info', 'debug'])
.default({
u: 'mqtt://127.0.0.1',
t: 'frenchtools',
v: 'info'
})
.help('help')
.help()
.version()
.strictOptions(true)
.parserConfiguration({
Expand Down
6 changes: 5 additions & 1 deletion lib/logs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const { logVerbosity } = require('./config')
const { logVerbosity, noColor } = require('./config')
const logger = require('yalm')
logger.setLevel(logVerbosity)

if (noColor) {
logger.setColor(false)
}

module.exports = logger
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mqtt4frenchtools",
"version": "1.0.0",
"version": "1.0.1",
"description": "Publish multiple french data to MQTT",
"main": "index.js",
"bin": {
Expand Down Expand Up @@ -49,7 +49,7 @@
"aedes": "^0.48.0",
"axios-mock-adapter": "^1.21.2",
"coveralls": "^3.1.1",
"eslint": "^8.27.0",
"eslint": "^8.28.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.1.5",
Expand Down
11 changes: 9 additions & 2 deletions tests/infofrance.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ describe('Test getJourSemAn function', () => {
const res2 = { dstdate: '27/03/2033', dstdiff: 86, nbjouran: 366, numjouran: 366, numsem: 53 }
const res3 = { dstdate: '27/10', dstdiff: 179, nbjouran: 366, numjouran: 122, numsem: 18 }
const res4 = { dstdate: '31/03', dstdiff: 90, nbjouran: 366, numjouran: 1, numsem: 1 }
const res5 = { dstdate: '30/10', dstdiff: 78, nbjouran: 365, numjouran: 225, numsem: 32 }
const res5 = { dstdate: '30/10', dstdiff: 170, nbjouran: 365, numjouran: 133, numsem: 19 }
const res6 = { dstdate: '30/10', dstdiff: 212, nbjouran: 365, numjouran: 91, numsem: 13 }
afterEach(() => {
jest.useRealTimers()
})
Expand Down Expand Up @@ -74,10 +75,16 @@ describe('Test getJourSemAn function', () => {
})
test('should return correct values 5', async () => {
const spy = jest.spyOn(eventEmitter, 'emit').mockImplementation(() => {})
jest.useFakeTimers({ now: new Date(2022, 7, 13) })
jest.useFakeTimers({ now: new Date(2022, 4, 13) })
await client.getJourSemAn()
expect(spy).toHaveBeenCalledWith('frame', 'global/annee', res5)
})
test('should return correct values 6', async () => {
const spy = jest.spyOn(eventEmitter, 'emit').mockImplementation(() => {})
jest.useFakeTimers({ now: new Date(2022, 3, 1) })
await client.getJourSemAn()
expect(spy).toHaveBeenCalledWith('frame', 'global/annee', res6)
})
})

describe('Test getLastDimanche function', () => {
Expand Down

0 comments on commit f04fc0d

Please sign in to comment.