Skip to content

Commit

Permalink
test: add MPD NUTs for CFT/COT
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Oct 31, 2023
1 parent be9c147 commit 02f4423
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"test:nuts:manifest": "nyc mocha \"test/nuts/manifest/*.nut.ts\" --slow 4500 --timeout 1200000 --parallel --retries 0 --jobs 20",
"test:nuts:retrieve": "nyc mocha \"test/nuts/retrieve/*.nut.ts\" --slow 4500 --timeout 1200000 --parallel --retries 0 --jobs 20",
"test:nuts:specialTypes": "nyc mocha \"test/nuts/specialTypes/*.nut.ts\" --slow 4500 --timeout 1200000 --parallel --retries 0 --jobs 20",
"test:nuts:specialTypes:translations": "mocha \"test/nuts/specialTypes/translation.nut.ts\" --slow 4500 --timeout 1200000 --retries 0 --jobs 20",
"test:nuts:static": "nyc mocha \"test/commands/**/*.nut.ts\" \"test/nuts/*.nut.ts\" --slow 4500 --timeout 1200000 --parallel --retries 0 --jobs 20",
"test:nuts:tracking": "nyc mocha \"test/nuts/tracking/*.nut.ts\" --slow 4500 --timeout 1200000 --parallel --retries 0 --jobs 20",
"test:only": "wireit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
{
"path": "force-app",
"default": true
},
{
"path": "my-app",
"default": false
}
],
"name": "default",
Expand Down
44 changes: 40 additions & 4 deletions test/nuts/specialTypes/translation.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('translations', () => {
let session: TestSession;
let projectPath: string;
let translationPath: string;
let fieldTranslationPath: string;

before(async () => {
session = await TestSession.create({
Expand All @@ -31,8 +32,14 @@ describe('translations', () => {
},
],
});
projectPath = path.join(session.project.dir, 'force-app', 'main', 'default');
projectPath = path.join(session.project.dir, 'my-app', 'main', 'default');
translationPath = path.join(projectPath, 'objectTranslations', 'customObject__c-es');
fieldTranslationPath = path.join(
projectPath,
'objectTranslations',
'customObject__c-es',
'customField__c.fieldTranslation-meta.xml'
);
});

after(async () => {
Expand Down Expand Up @@ -77,15 +84,15 @@ describe('translations', () => {
});

it('can generate manifest for translation types', async () => {
execCmd('force:source:manifest:create -p force-app --json', { ensureExitCode: 0 });
execCmd('force:source:manifest:create -p my-app --json', { ensureExitCode: 0 });
expect(fs.existsSync(path.join(session.project.dir, 'package.xml'))).to.be.true;
});

it('deploy', () => {
const deployResults = execCmd<DeployResultJson>('project deploy start -x package.xml --json', {
ensureExitCode: 0,
}).jsonOutput?.result;
expect(deployResults?.files.length).to.equal(7);
expect(deployResults?.files.length).to.equal(2);
});

it('retrieve without local metadata', async () => {
Expand All @@ -95,7 +102,7 @@ describe('translations', () => {
const retrieveResults = execCmd<RetrieveResultJson>('project retrieve start -x package.xml --json', {
ensureExitCode: 0,
}).jsonOutput?.result;
expect(retrieveResults?.files).to.have.length(7);
expect(retrieveResults?.files).to.have.length(2);
});
});

Expand Down Expand Up @@ -181,6 +188,35 @@ describe('translations', () => {
});
});
});
describe('MPD', () => {
describe('deploy', () => {
it('can deploy the whole project', async () => {
execCmd('project deploy start -d force-app -d my-app --json', {
ensureExitCode: 0,
});
});
});

describe('retrieve', () => {
it('can retrieve the whole project', async () => {
execCmd('project retrieve start -d force-app -d my-app --json', {
ensureExitCode: 0,
});
});

describe('individual type retrieves', () => {
before(() => {
fs.unlinkSync(fieldTranslationPath);
});
it('will write the CFT with the COT, even when not in the default package', async () => {
execCmd(`project retrieve start -d ${translationPath} --json`, {
ensureExitCode: 0,
});
expect(fs.existsSync(fieldTranslationPath)).to.be.true;
});
});
});
});

describe('mdapi format', () => {
it('can convert COT/CFTs correctly', () => {
Expand Down

0 comments on commit 02f4423

Please sign in to comment.