This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
list.nut.ts
126 lines (114 loc) · 3.74 KB
/
list.nut.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { expect } from '@salesforce/command/lib/test';
let testSession: TestSession;
describe('config:list NUTs', async () => {
testSession = await TestSession.create({
project: { name: 'configListNUTs' },
});
describe('config:list with no configs set', () => {
it('lists no config entries correctly', () => {
const res = execCmd('config:list --json', { ensureExitCode: 0 });
expect(res.jsonOutput).to.deep.equal({
result: [],
status: 0,
});
});
it('lists no configs stdout', () => {
const res: string = execCmd('config:list').shellOutput;
expect(res).to.include('No results found');
});
});
describe('config:list with singular result', () => {
before(() => {
execCmd('config:set apiVersion=51.0 --global');
});
it('lists singular config correctly', () => {
const res = execCmd('config:list --json', { ensureExitCode: 0 });
expect(res.jsonOutput).to.deep.equal({
result: [
{
key: 'apiVersion',
location: 'Global',
value: '51.0',
},
],
status: 0,
warnings: ['apiVersion configuration overridden at "51.0"'],
});
});
it('properly overwrites config values, with local > global', () => {
execCmd('config:set apiVersion=52.0 --json');
const res = execCmd('config:list --json', { ensureExitCode: 0 });
expect(res.jsonOutput).to.deep.equal({
result: [
{
key: 'apiVersion',
location: 'Local',
value: '52.0',
},
],
status: 0,
warnings: ['apiVersion configuration overridden at "52.0"'],
});
});
it('lists singular result correctly stdout', () => {
const res: string = execCmd('config:list').shellOutput.stdout;
expect(res).to.include('List Config');
expect(res).to.include('apiVersion');
expect(res).to.include('Local');
expect(res).to.include('52.0');
execCmd('config:unset apiVersion');
});
});
describe('config:list with multiple results', () => {
beforeEach(() => {
execCmd('config:set apiVersion=51.0 --global');
execCmd('config:set maxQueryLimit=100 --global');
});
it('lists multiple results correctly JSON', () => {
execCmd('config:set restDeploy=false');
const res = execCmd('config:list --json', { ensureExitCode: 0 });
expect(res.jsonOutput).to.deep.equal({
result: [
{
key: 'apiVersion',
location: 'Global',
value: '51.0',
},
{
key: 'maxQueryLimit',
location: 'Global',
value: '100',
},
{
key: 'restDeploy',
location: 'Local',
value: 'false',
},
],
status: 0,
warnings: ['apiVersion configuration overridden at "51.0"'],
});
});
it('lists multiple results correctly stdout', () => {
execCmd('config:set restDeploy=false');
const res: string = execCmd('config:list', { ensureExitCode: 0 }).shellOutput.stdout;
expect(res).to.include('List Config');
expect(res).to.include('apiVersion');
expect(res).to.include('51.0');
expect(res).to.include('maxQueryLimit');
expect(res).to.include('100');
expect(res).to.include('restDeploy');
expect(res).to.include('false');
});
});
});
after(async () => {
await testSession?.clean();
});