You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
describe('should include no-restricted-imports',()=>{
137
+
describe('prevents imports from @salesforce/lds',()=>{
138
+
it('should prevent nested imports',async()=>{
139
+
setupBaseListConfigAndAssertMessages(
140
+
`
141
+
import { abc } from '@salesforce/lds/test';
142
+
`,
143
+
[
144
+
{
145
+
ruleId: 'no-restricted-imports',
146
+
message:
147
+
"'@salesforce/lds/test' import is restricted from being used by a pattern. Please do not import from @salesforce/lds, these modules are ephemeral and could change at any time.",
148
+
},
149
+
],
150
+
);
151
+
});
152
+
153
+
it('should prevent imports from restricted modules',async()=>{
154
+
setupBaseListConfigAndAssertMessages(
155
+
`
156
+
import foo from '@salesforce/lds';
157
+
`,
158
+
[
159
+
{
160
+
ruleId: 'no-restricted-imports',
161
+
message:
162
+
"'@salesforce/lds' import is restricted from being used by a pattern. Please do not import from @salesforce/lds, these modules are ephemeral and could change at any time.",
163
+
},
164
+
],
165
+
);
166
+
});
167
+
168
+
it('does not prevent imports from similarly named modules',async()=>{
169
+
setupBaseListConfigAndAssertMessages(
170
+
`
171
+
import foo from '@salesforce/ldsnotlds';
172
+
`,
173
+
);
174
+
});
175
+
});
176
+
});
135
177
});
178
+
179
+
/**
180
+
* Sets up the linter and runs it against the given text.
181
+
* @constructor
182
+
* @param {string} text - The text to lint
183
+
* @param {Object[]} expectedMessages - The employees who are responsible for the project.
184
+
* @param {string} expectedMessages[].ruleId - The lint rule id that should fail.
185
+
* @param {string} [expectedMessages[].message] - The message that the lint rule should throw.
0 commit comments