Skip to content

Commit 9e454de

Browse files
test: add NUTs
1 parent 0d35b72 commit 9e454de

8 files changed

Lines changed: 33 additions & 19 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"orgName": "Willie Agent NUTs",
3+
"edition": "Developer",
4+
"features": ["EnableSetPasswordInApi", "Einstein1AIPlatform"],
5+
"settings": {
6+
"lightningExperienceSettings": {
7+
"enableS1DesktopEnabled": true
8+
},
9+
"mobileSettings": {
10+
"enableS1EncryptedStoragePref2": false
11+
},
12+
"agentPlatformSettings": {
13+
"enableAgentPlatform": true
14+
},
15+
"einsteinGptSettings": {
16+
"enableEinsteinGptPlatform": true
17+
}
18+
}
19+
}

test/nut/agents/agent-project/force-app/main/default/aiAuthoringBundles/myBundle/myBundle.agent renamed to test/nut/agent-project/force-app/main/default/aiAuthoringBundles/myBundle/myBundle.agent

File renamed without changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<AiAuthoringBundle xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<bundleType>AGENT</bundleType>
4+
</AiAuthoringBundle>
File renamed without changes.
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,24 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
import path from 'node:path';
1617
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
1718
import { expect } from 'chai';
18-
import { AgentUserCreateResponse } from '../../../src/commands/org/create/agent-user.js';
19+
import { AgentUserCreateResponse } from '../../src/commands/org/create/agent-user.js';
1920

2021
describe('org:create:agent-user NUTs', () => {
2122
let session: TestSession;
2223

2324
before(async () => {
2425
session = await TestSession.create({
25-
project: { sourceDir: 'agent-project' },
26+
project: { sourceDir: path.join('test', 'nut', 'agent-project') },
2627
devhubAuthStrategy: 'AUTO',
27-
scratchOrgs: [{ alias: 'agentOrg' }],
28+
scratchOrgs: [
29+
{
30+
alias: 'agentOrg',
31+
config: path.join('config', 'project-scratch-def.json'),
32+
},
33+
],
2834
});
2935
});
3036

@@ -64,8 +70,6 @@ describe('org:create:agent-user NUTs', () => {
6470
expect(result?.permissionSetErrors).to.be.an('array').that.is.empty;
6571
});
6672

67-
it('should deploy metadata, replace, and publish agent with generated default_agent_user', () => {});
68-
6973
it('should create an agent user with custom base username', () => {
7074
const result = execCmd<AgentUserCreateResponse>(
7175
'org:create:agent-user --target-org agentOrg --base-username service-agent@test.com --json',
@@ -100,6 +104,7 @@ describe('org:create:agent-user NUTs', () => {
100104

101105
expect(error?.name).to.equal('InvalidBaseUsernameError');
102106
expect(error?.message).to.include('Must include @ symbol');
107+
expect(error?.actions).to.include('Provide a base username in email format, e.g., service-agent@corp.com');
103108
});
104109
});
105110
});

test/nut/agents/agent-project/config/project-scratch-def.json

Whitespace-only changes.

test/nut/agents/agent-project/force-app/main/default/aiAuthoringBundles/myBundle/myBundle.bundle-meta.xml

Whitespace-only changes.

test/unit/org/create/agent-user.test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,4 @@ describe('org:create:agent-user', () => {
253253
}
254254
});
255255
});
256-
257-
describe('Input Validation', () => {
258-
it('should throw InvalidBaseUsernameError for invalid base username format', () => {
259-
const error = new SfError(
260-
'Invalid base username format: "invalidformat". Must include @ symbol.',
261-
'InvalidBaseUsernameError',
262-
['Provide a base username in email format, e.g., service-agent@corp.com']
263-
);
264-
265-
expect(error.name).to.equal('InvalidBaseUsernameError');
266-
expect(error.message).to.include('Must include @ symbol');
267-
expect(error.actions).to.include('Provide a base username in email format, e.g., service-agent@corp.com');
268-
});
269-
});
270256
});

0 commit comments

Comments
 (0)