@defra-fish/pocl-job 1.63.0-rc.9 → 1.63.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra-fish/pocl-job",
3
- "version": "1.63.0-rc.9",
3
+ "version": "1.63.0",
4
4
  "description": "Post Office Counter Licence sales processor",
5
5
  "type": "module",
6
6
  "engines": {
@@ -35,8 +35,8 @@
35
35
  "test": "echo \"Error: run tests from root\" && exit 1"
36
36
  },
37
37
  "dependencies": {
38
- "@defra-fish/business-rules-lib": "1.63.0-rc.9",
39
- "@defra-fish/connectors-lib": "1.63.0-rc.9",
38
+ "@defra-fish/business-rules-lib": "1.63.0",
39
+ "@defra-fish/connectors-lib": "1.63.0",
40
40
  "commander": "^7.2.0",
41
41
  "debug": "^4.3.3",
42
42
  "filesize": "^6.4.0",
@@ -45,5 +45,5 @@
45
45
  "moment-timezone": "^0.5.34",
46
46
  "sax-stream": "^1.3.0"
47
47
  },
48
- "gitHead": "fc11192e1947a9a254138b543c8718ad892f0a15"
48
+ "gitHead": "7cfb8ef668002fc340b755dd3aaa4572063e115c"
49
49
  }
@@ -1,5 +1,6 @@
1
1
  import { execute } from '../pocl-processor.js'
2
2
  import commander from 'commander'
3
+ import fs from 'fs'
3
4
 
4
5
  jest.mock('commander', () => {
5
6
  if (!global.commander) {
@@ -26,6 +27,22 @@ describe('pocl-job', () => {
26
27
  jest.clearAllMocks()
27
28
  })
28
29
 
30
+ it('logs startup details including name and version', () => {
31
+ const mockPkg = { name: 'pocl-test', version: '1.2.3' }
32
+ fs.readFileSync.mockReturnValue(JSON.stringify(mockPkg))
33
+
34
+ jest.isolateModules(() => {
35
+ const logSpy = jest.spyOn(console, 'log').mockImplementation(() => {})
36
+ require('../pocl-job.js')
37
+ expect(logSpy).toHaveBeenCalledWith(
38
+ 'POCL job starting at %s. name: %s. version: %s',
39
+ expect.any(String),
40
+ mockPkg.name,
41
+ mockPkg.version
42
+ )
43
+ })
44
+ })
45
+
29
46
  it('exposes an execute command to the cli', async () => {
30
47
  jest.isolateModules(() => {
31
48
  require('../pocl-job.js')
package/src/pocl-job.js CHANGED
@@ -1,6 +1,13 @@
1
1
  'use strict'
2
2
  import poclJob from 'commander'
3
3
  import { execute } from './pocl-processor.js'
4
+ import path from 'path'
5
+ import fs from 'fs'
6
+
7
+ const pkgPath = path.join(process.cwd(), 'package.json')
8
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
9
+
10
+ console.log('POCL job starting at %s. name: %s. version: %s', new Date().toISOString(), pkg.name, pkg.version)
4
11
 
5
12
  poclJob
6
13
  .command('execute')