Skip to content

Commit b083157

Browse files
SAAS-4717 #time 0h 40m Remove automatic parse number on image tag (#391)
* SAAS-4717 #time 0h 40m Remove automatic parse number on `image tag` command * SAAS-4717 #time 0h 20m Added tests
1 parent 3a23be4 commit b083157

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

lib/interface/cli/commands/image/image.sdk.spec.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const getCmd = require('./get.cmd').toCommand();
2+
const yargs = require('yargs');
23

34
let annotateCmd = require('./annotate.cmd');
45
let tagCmd = require('./tag.cmd');
@@ -15,11 +16,9 @@ untagCmd = untagCmd.toCommand();
1516

1617
jest.mock('../../../../logic/entities/Image');
1718

18-
jest.mock('../../helpers/image', () => {
19-
return {
20-
extractImages: images => images,
21-
};
22-
});
19+
jest.mock('../../helpers/image', () => ({
20+
extractImages: images => images,
21+
}));
2322

2423
const request = require('requestretry');
2524

@@ -32,6 +31,27 @@ describe('image commands', () => {
3231
await configureSdk(); // eslint-disable-line
3332
});
3433

34+
describe('stop parse number', () => {
35+
it('should be string', async () => {
36+
const { numberArg } = yargs(['--numberArg', '21'])
37+
.parserConfiguration({
38+
'parse-numbers': false,
39+
})
40+
.option('numberArg', {})
41+
.argv;
42+
43+
expect(typeof numberArg).toBe('string');
44+
});
45+
46+
it('should be number', async () => {
47+
const { numberArg } = yargs(['--numberArg', '21'])
48+
.option('numberArg', {})
49+
.argv;
50+
51+
expect(typeof numberArg).toBe('number');
52+
});
53+
});
54+
3555
describe('get', () => {
3656
it('should handle getting given id', async () => {
3757
const argv = { id: ['some id'], label: [], tag: [] };

lib/interface/cli/commands/image/tag.cmd.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ const tag = new Command({
1616
},
1717
builder: (yargs) => {
1818
yargs
19+
.parserConfiguration({
20+
'parse-numbers': false,
21+
})
1922
.positional('id', {
2023
description: 'Docker image id',
2124
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.40.1",
3+
"version": "0.41.0",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)