@contrail/cli 2.2.3 → 2.2.4

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/README.md CHANGED
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
17
17
  $ contrail COMMAND
18
18
  running command...
19
19
  $ contrail (--version)
20
- @contrail/cli/2.2.3 darwin-arm64 node-v18.13.0
20
+ @contrail/cli/2.2.4 darwin-arm64 node-v18.13.0
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -40,7 +40,9 @@ function visibilityValidator(appDeclaration) {
40
40
  error: 'Invalid visibility. Visibility must be "public" or "private".',
41
41
  };
42
42
  }
43
- if (appDeclaration.visibility === 'private' && appDeclaration.hidden !== true) {
43
+ if (appDeclaration.visibility === 'private' &&
44
+ Object.prototype.hasOwnProperty.call(appDeclaration, 'hidden') &&
45
+ appDeclaration.hidden === true) {
44
46
  return {
45
47
  error: 'Apps can not be private and hidden.',
46
48
  };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const app_config_validators_1 = require("./app-config-validators");
4
+ const app_config_validators_2 = require("./app-config-validators");
4
5
  describe('appVersionValidator', () => {
5
6
  it('should return an error if "version" field is missing', () => {
6
7
  const appDeclaration = {};
@@ -65,3 +66,41 @@ it('should return an error if app version has invalid format', () => {
65
66
  const validationResult = (0, app_config_validators_1.appVersionValidator)(appDeclaration);
66
67
  expect(validationResult).toEqual(expectedError);
67
68
  });
69
+ describe('visibilityValidator', () => {
70
+ it('should return an error if visibility is neither "public" nor "private"', () => {
71
+ const appDeclaration = {
72
+ visibility: 'invalidVisibility',
73
+ };
74
+ const expectedError = {
75
+ error: 'Invalid visibility. Visibility must be "public" or "private".',
76
+ };
77
+ const validationResult = (0, app_config_validators_2.visibilityValidator)(appDeclaration);
78
+ expect(validationResult).toEqual(expectedError);
79
+ });
80
+ it('should return an error if app is private and not hidden', () => {
81
+ const appDeclaration = {
82
+ visibility: 'private',
83
+ hidden: true,
84
+ };
85
+ const expectedError = {
86
+ error: 'Apps can not be private and hidden.',
87
+ };
88
+ const validationResult = (0, app_config_validators_2.visibilityValidator)(appDeclaration);
89
+ expect(validationResult).toEqual(expectedError);
90
+ });
91
+ it('should not return an error if visibility is "public"', () => {
92
+ const appDeclaration = {
93
+ visibility: 'public',
94
+ };
95
+ const validationResult = (0, app_config_validators_2.visibilityValidator)(appDeclaration);
96
+ expect(validationResult).toBeUndefined();
97
+ });
98
+ it('should not return an error if app is private and hidden', () => {
99
+ const appDeclaration = {
100
+ visibility: 'private',
101
+ hidden: false,
102
+ };
103
+ const validationResult = (0, app_config_validators_2.visibilityValidator)(appDeclaration);
104
+ expect(validationResult).toBeUndefined();
105
+ });
106
+ });
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.2.3",
2
+ "version": "2.2.4",
3
3
  "commands": {
4
4
  "app:create": {
5
5
  "id": "app:create",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",