Skip to content

Commit 21d8326

Browse files
committed
test: add test for --flags-dir
1 parent 0f8f796 commit 21d8326

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

test/commands/crud-mdapi/read.e2e.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,43 @@ import { run } from "../../e2e.js";
77
const DEFAULT_PACKAGE_DIR = join("force-app", "main", "default");
88

99
describe("crud-mdapi read", () => {
10+
describe("flags-dir", async () => {
11+
afterEach("delete", async function () {
12+
rmSync(DEFAULT_PACKAGE_DIR, {
13+
recursive: true,
14+
});
15+
});
16+
it("reads a CustomField without flags-dir", async () => {
17+
await run(`crud-mdapi read --metadata CustomField:Account.Name`);
18+
expect(
19+
readFileSync(
20+
join(
21+
DEFAULT_PACKAGE_DIR,
22+
"objects",
23+
"Account",
24+
"fields",
25+
"Name.field-meta.xml"
26+
),
27+
"utf8"
28+
).split("\n")
29+
).to.contain(` <fullName>Name</fullName>`);
30+
});
31+
it("reads a CustomField with flags-dir", async () => {
32+
await run(`crud-mdapi read --flags-dir test/fixtures/myflags`);
33+
expect(
34+
readFileSync(
35+
join(
36+
DEFAULT_PACKAGE_DIR,
37+
"objects",
38+
"Account",
39+
"fields",
40+
"Name.field-meta.xml"
41+
),
42+
"utf8"
43+
).split("\n")
44+
).to.contain(` <fullName>Name</fullName>`);
45+
});
46+
});
1047
describe("CustomObjectTranslations with FieldTranslations", async () => {
1148
before("deploy", async function () {
1249
this.timeout(300 * 1000);
@@ -46,6 +83,7 @@ describe("crud-mdapi read", () => {
4683
"project",
4784
"delete",
4885
"source",
86+
"--json",
4987
"--no-prompt",
5088
"--metadata",
5189
"CustomObject:Dummy__c",
@@ -80,6 +118,7 @@ describe("crud-mdapi read", () => {
80118
"project",
81119
"delete",
82120
"source",
121+
"--json",
83122
"--no-prompt",
84123
"--metadata",
85124
"CustomField:Account.IsTest__c",
@@ -139,6 +178,7 @@ describe("crud-mdapi read", () => {
139178
"project",
140179
"delete",
141180
"source",
181+
"--json",
142182
"--no-prompt",
143183
"--metadata",
144184
"CustomObject:DummyWithRT__c",
@@ -180,6 +220,7 @@ describe("crud-mdapi read", () => {
180220
"project",
181221
"delete",
182222
"source",
223+
"--json",
183224
"--no-prompt",
184225
"--metadata",
185226
"CustomLabel:Greeting",

test/fixtures/myflags/metadata

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CustomField:Account.Name

0 commit comments

Comments
 (0)