Skip to content

Commit 10d9435

Browse files
committed
test: another local nut for customLabel sourceMember stuff
1 parent 05db59e commit 10d9435

5 files changed

+43
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"prune:dead": "ts-prune | grep -v 'source-deploy-retrieve' | grep -v 'index.ts'",
2626
"test": "sf-test",
2727
"test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
28-
"test:nuts:local": "mocha \"**/local*.nut.ts\" --slow 4500 --timeout 600000 --parallel"
28+
"test:nuts:local": "mocha \"**/local/*.nut.ts\" --slow 4500 --timeout 600000 --parallel"
2929
},
3030
"keywords": [
3131
"force",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2020, salesforce.com, inc.
3+
* All rights reserved.
4+
* Licensed under the BSD 3-Clause license.
5+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
import * as path from 'path';
8+
import { TestSession } from '@salesforce/cli-plugins-testkit';
9+
import { expect } from 'chai';
10+
import { ComponentStatus } from '@salesforce/source-deploy-retrieve';
11+
import { getMetadataKeyFromFileResponse } from '../../../src/shared/metadataKeys';
12+
13+
// this is a NUT to avoid fs-mocking the CustomLabels file that SDR is going to read to getChildren
14+
describe('end-to-end-test for custom labels', () => {
15+
let session: TestSession;
16+
17+
before(async () => {
18+
session = await TestSession.create({
19+
project: {
20+
sourceDir: path.join('test', 'nuts', 'repros', 'duplabels'),
21+
},
22+
authStrategy: 'NONE',
23+
});
24+
});
25+
26+
after(async () => {
27+
await session?.clean();
28+
});
29+
30+
it('translates labels to label[]', () => {
31+
const testResponse = {
32+
filePath: path.join(session.project.dir, 'pkg1', 'Test1.labels-meta.xml'),
33+
type: 'CustomLabels',
34+
state: ComponentStatus.Created,
35+
fullName: 'Test1',
36+
};
37+
expect(getMetadataKeyFromFileResponse(testResponse)).to.deep.equal(['CustomLabel__Label1']);
38+
});
39+
});

test/nuts/localTrackingScenario.nut.ts test/nuts/local/localTrackingScenario.nut.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { TestSession } from '@salesforce/cli-plugins-testkit';
1010
import { fs } from '@salesforce/core';
1111
import { expect } from 'chai';
1212
import { shouldThrow } from '@salesforce/core/lib/testSetup';
13-
import { ShadowRepo } from '../../src/shared/localShadowRepo';
13+
import { ShadowRepo } from '../../../src/shared/localShadowRepo';
1414

1515
describe('end-to-end-test for local tracking', () => {
1616
let session: TestSession;

test/nuts/localNonTopLevelIgnore.nut.ts test/nuts/local/nonTopLevelIgnore.nut.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as path from 'path';
88
import { TestSession } from '@salesforce/cli-plugins-testkit';
99
import { fs } from '@salesforce/core';
1010
import { expect } from 'chai';
11-
import { ShadowRepo } from '../../src/shared/localShadowRepo';
11+
import { ShadowRepo } from '../../../src/shared/localShadowRepo';
1212

1313
describe('handles non-top-level ignore', () => {
1414
let session: TestSession;

test/nuts/localPkgDirMatching.nut.ts test/nuts/local/pkgDirMatching.nut.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as path from 'path';
88
import { TestSession } from '@salesforce/cli-plugins-testkit';
99
import { fs } from '@salesforce/core';
1010
import { expect } from 'chai';
11-
import { ShadowRepo } from '../../src/shared/localShadowRepo';
11+
import { ShadowRepo } from '../../../src/shared/localShadowRepo';
1212

1313
describe('verifies exact match of pkgDirs', () => {
1414
let session: TestSession;

0 commit comments

Comments
 (0)