Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wr/coft NUTs #783

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
71 changes: 62 additions & 9 deletions test/nuts/specialTypes/translation.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('translations', () => {
after(async () => {
await session?.clean();
});

describe('tracking/push', () => {
it('can deploy the whole project', async () => {
execCmd('project deploy start --json', {
Expand Down Expand Up @@ -161,24 +162,76 @@ describe('translations', () => {
});

describe('individual type retrieves', () => {
it('can retrieve COT', async () => {
it('can retrieve COT from CFT', async () => {
execCmd(`project retrieve start -d ${translationPath} --json`, {
ensureExitCode: 0,
});
});

it('can retrieve COT from directory', async () => {
execCmd(
`project retrieve start -d ${path.join(
translationPath,
'customObject__c-es.objectTranslation-meta.xml'
)} --json`,
{
ensureExitCode: 0,
}
// the .objectTranslation is in my-app
const objectTranslationPath = path.join(
session.project.dir,
'my-app',
'main',
'default',
'objectTranslations',
'customObject__c-es',
'customObject__c-es.objectTranslation-meta.xml'
);

execCmd(`project retrieve start -d ${objectTranslationPath} --json`, {
ensureExitCode: 0,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is retrieving a COT by filename, not directory. Also, I think we can't rely on just the exit code 0 as a success. I think we need to ensure the retrieve was written to the correct place and not the default location.

});
});

it('will retrieve across MPDs', async () => {
// read the file before deleting it to restore it after this test
const objectTranslationMyAppPath = path.join(
session.project.dir,
'my-app',
'main',
'default',
'objectTranslations',
'customObject__c-es',
'customObject__c-es.objectTranslation-meta.xml'
);
const objectTranslationContent = await fs.promises.readFile(objectTranslationMyAppPath, 'utf8');

// delete the file
await fs.promises.unlink(objectTranslationMyAppPath);
execCmd('project retrieve start -m CustomObjectTranslation --json', { ensureExitCode: 0 });
expect(
fs.existsSync(
path.join(
session.project.dir,
'force-app',
'main',
'default',
'objectTranslations',
'customObject__c-es',
'customObject__c-es.objectTranslation-meta.xml'
)
)
).to.be.true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't really retrieving across package dirs. It's retrieving a COT to the default location. I think we need a test that has COT and COFT and ensure it can be retrieved to the default package and to a specific non-default package. E.g., having a COT in my-app, deploying a COFT for that COT from outside of the project, then retrieving it.


// if the assertions passed, let's delete the new file, and recreate the old
await Promise.all([
fs.promises.unlink(
path.join(
session.project.dir,
'force-app',
'main',
'default',
'objectTranslations',
'customObject__c-es',
'customObject__c-es.objectTranslation-meta.xml'
)
),
fs.promises.writeFile(objectTranslationMyAppPath, objectTranslationContent),
]);
});
});
});

Expand Down
Loading