@hero-design/snowflake-guard 1.4.9 → 1.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/lib/src/__tests__/parseMobileSource.spec.d.ts +0 -1
- package/lib/src/__tests__/parseMobileSource.spec.js +0 -417
- package/lib/src/__tests__/parseSource.spec.d.ts +0 -1
- package/lib/src/__tests__/parseSource.spec.js +0 -207
- package/lib/src/graphql/__tests__/fetchGrapql.spec.d.ts +0 -1
- package/lib/src/graphql/__tests__/fetchGrapql.spec.js +0 -33
- package/lib/src/graphql/__tests__/queryGenerators.spec.d.ts +0 -1
- package/lib/src/graphql/__tests__/queryGenerators.spec.js +0 -82
- package/lib/src/graphql/fetchGraphql.d.ts +0 -2
- package/lib/src/graphql/fetchGraphql.js +0 -23
- package/lib/src/graphql/queryGenerators.d.ts +0 -18
- package/lib/src/graphql/queryGenerators.js +0 -61
- package/lib/src/graphql/types.d.ts +0 -18
- package/lib/src/graphql/types.js +0 -2
- package/lib/src/index.d.ts +0 -3
- package/lib/src/index.js +0 -175
- package/lib/src/parseMobileSource.d.ts +0 -15
- package/lib/src/parseMobileSource.js +0 -135
- package/lib/src/parseSource.d.ts +0 -17
- package/lib/src/parseSource.js +0 -138
- package/lib/src/parsers/flow.d.ts +0 -3
- package/lib/src/parsers/flow.js +0 -47
- package/lib/src/parsers/typescript.d.ts +0 -3
- package/lib/src/parsers/typescript.js +0 -47
- package/lib/src/reports/__tests__/reportInlineStyle.spec.d.ts +0 -1
- package/lib/src/reports/__tests__/reportInlineStyle.spec.js +0 -143
- package/lib/src/reports/constants.d.ts +0 -233
- package/lib/src/reports/constants.js +0 -917
- package/lib/src/reports/mobile/__tests__/reportCustomStyleProperties.spec.d.ts +0 -1
- package/lib/src/reports/mobile/__tests__/reportCustomStyleProperties.spec.js +0 -144
- package/lib/src/reports/mobile/__tests__/reportInlineStyle.spec.d.ts +0 -1
- package/lib/src/reports/mobile/__tests__/reportInlineStyle.spec.js +0 -113
- package/lib/src/reports/mobile/__tests__/reportStyledComponents.spec.d.ts +0 -1
- package/lib/src/reports/mobile/__tests__/reportStyledComponents.spec.js +0 -54
- package/lib/src/reports/mobile/constants.d.ts +0 -106
- package/lib/src/reports/mobile/constants.js +0 -470
- package/lib/src/reports/mobile/reportCustomStyleProperties.d.ts +0 -24
- package/lib/src/reports/mobile/reportCustomStyleProperties.js +0 -193
- package/lib/src/reports/mobile/reportInlineStyle.d.ts +0 -20
- package/lib/src/reports/mobile/reportInlineStyle.js +0 -223
- package/lib/src/reports/mobile/reportStyledComponents.d.ts +0 -6
- package/lib/src/reports/mobile/reportStyledComponents.js +0 -105
- package/lib/src/reports/mobile/testUtils.d.ts +0 -1
- package/lib/src/reports/mobile/testUtils.js +0 -42
- package/lib/src/reports/mobile/types.d.ts +0 -3
- package/lib/src/reports/mobile/types.js +0 -2
- package/lib/src/reports/reportClassName.d.ts +0 -3
- package/lib/src/reports/reportClassName.js +0 -12
- package/lib/src/reports/reportCustomStyleProperties.d.ts +0 -25
- package/lib/src/reports/reportCustomStyleProperties.js +0 -185
- package/lib/src/reports/reportInlineStyle.d.ts +0 -23
- package/lib/src/reports/reportInlineStyle.js +0 -238
- package/lib/src/reports/reportStyledComponents.d.ts +0 -6
- package/lib/src/reports/reportStyledComponents.js +0 -105
- package/lib/src/reports/types.d.ts +0 -3
- package/lib/src/reports/types.js +0 -2
- package/lib/src/utils/__tests__/getDiffLocs.spec.d.ts +0 -1
- package/lib/src/utils/__tests__/getDiffLocs.spec.js +0 -43
- package/lib/src/utils/getDiffLocs.d.ts +0 -3
- package/lib/src/utils/getDiffLocs.js +0 -40
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
const fs = __importStar(require("fs"));
|
|
40
|
-
const parseMobileSource_1 = __importDefault(require("../parseMobileSource"));
|
|
41
|
-
describe('parseSource', () => {
|
|
42
|
-
it('reports correct snowflakes with typescript files', () => {
|
|
43
|
-
const source = fs.readFileSync('./src/__mocks__/mobileSourceSample.tsx', 'utf-8');
|
|
44
|
-
expect((0, parseMobileSource_1.default)(source)).toEqual({
|
|
45
|
-
approvedLocs: [59, 61, 77, 86, 23],
|
|
46
|
-
styleLocs: [
|
|
47
|
-
76, 80, 87, 53, 55, 56, 57, 58, 69, 71, 72, 73, 74, 75, 89, 98, 107,
|
|
48
|
-
115, 120, 128,
|
|
49
|
-
],
|
|
50
|
-
styledComponentLocs: [19, 28, 33],
|
|
51
|
-
violatingAttributes: [
|
|
52
|
-
{
|
|
53
|
-
attributeName: 'padding',
|
|
54
|
-
attributeValue: '20',
|
|
55
|
-
componentName: 'Button.Icon',
|
|
56
|
-
inlineStyleProps: 'style',
|
|
57
|
-
loc: 76,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
attributeName: 'padding',
|
|
61
|
-
attributeValue: '20',
|
|
62
|
-
componentName: 'Button.Icon',
|
|
63
|
-
inlineStyleProps: 'style',
|
|
64
|
-
loc: 80,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
attributeName: 'backgroundColor',
|
|
68
|
-
attributeValue: "'red'",
|
|
69
|
-
componentName: 'Button.Icon',
|
|
70
|
-
inlineStyleProps: 'style',
|
|
71
|
-
loc: 80,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
attributeName: 'backgroundColor',
|
|
75
|
-
attributeValue: "'red'",
|
|
76
|
-
componentName: 'Button.Icon',
|
|
77
|
-
inlineStyleProps: 'style',
|
|
78
|
-
loc: 87,
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
attributeName: 'padding',
|
|
82
|
-
attributeValue: '10',
|
|
83
|
-
componentName: 'Tabs',
|
|
84
|
-
inlineStyleProps: 'barStyle',
|
|
85
|
-
loc: 53,
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
attributeName: 'width',
|
|
89
|
-
attributeValue: '100',
|
|
90
|
-
componentName: 'Tabs',
|
|
91
|
-
inlineStyleProps: 'containerStyle',
|
|
92
|
-
loc: 53,
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
attributeName: 'width',
|
|
96
|
-
attributeValue: '100',
|
|
97
|
-
componentName: 'Tabs.Scroll',
|
|
98
|
-
inlineStyleProps: 'containerStyle',
|
|
99
|
-
loc: 55,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
attributeName: 'color',
|
|
103
|
-
attributeValue: "'red'",
|
|
104
|
-
componentName: 'TextInput',
|
|
105
|
-
inlineStyleProps: 'textStyle',
|
|
106
|
-
loc: 56,
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
attributeName: 'color',
|
|
110
|
-
attributeValue: "'red'",
|
|
111
|
-
componentName: 'Search.OneLine',
|
|
112
|
-
inlineStyleProps: 'textStyle',
|
|
113
|
-
loc: 57,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
attributeName: 'borderColor',
|
|
117
|
-
attributeValue: "'red'",
|
|
118
|
-
componentName: 'Search.OneLine',
|
|
119
|
-
inlineStyleProps: 'textStyle',
|
|
120
|
-
loc: 57,
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
attributeName: 'color',
|
|
124
|
-
attributeValue: "'red'",
|
|
125
|
-
componentName: 'Toolbar.Message',
|
|
126
|
-
inlineStyleProps: 'textStyle',
|
|
127
|
-
loc: 58,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
attributeName: 'borderColor',
|
|
131
|
-
attributeValue: "'red'",
|
|
132
|
-
componentName: 'Toolbar.Message',
|
|
133
|
-
inlineStyleProps: 'textStyle',
|
|
134
|
-
loc: 58,
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
attributeName: 'width',
|
|
138
|
-
attributeValue: '200',
|
|
139
|
-
componentName: 'Empty',
|
|
140
|
-
inlineStyleProps: 'style',
|
|
141
|
-
loc: 69,
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
attributeName: 'width',
|
|
145
|
-
attributeValue: '200',
|
|
146
|
-
componentName: 'Button.Utility',
|
|
147
|
-
inlineStyleProps: 'style',
|
|
148
|
-
loc: 71,
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
attributeName: 'padding',
|
|
152
|
-
attributeValue: '30',
|
|
153
|
-
componentName: 'Button',
|
|
154
|
-
inlineStyleProps: 'style',
|
|
155
|
-
loc: 72,
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
attributeName: 'padding',
|
|
159
|
-
attributeValue: '30',
|
|
160
|
-
componentName: 'Button',
|
|
161
|
-
inlineStyleProps: 'style',
|
|
162
|
-
loc: 73,
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
attributeName: 'padding',
|
|
166
|
-
attributeValue: '30',
|
|
167
|
-
componentName: 'Button',
|
|
168
|
-
inlineStyleProps: 'style',
|
|
169
|
-
loc: 74,
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
attributeName: 'padding',
|
|
173
|
-
attributeValue: '30',
|
|
174
|
-
componentName: 'Button',
|
|
175
|
-
inlineStyleProps: 'style',
|
|
176
|
-
loc: 75,
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
attributeName: 'backgroundColor',
|
|
180
|
-
attributeValue: "'red'",
|
|
181
|
-
componentName: 'Chart.Column',
|
|
182
|
-
inlineStyleProps: 'style',
|
|
183
|
-
loc: 89,
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
attributeName: 'padding',
|
|
187
|
-
attributeValue: '10',
|
|
188
|
-
componentName: 'Chart.Column',
|
|
189
|
-
inlineStyleProps: 'style',
|
|
190
|
-
loc: 89,
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
attributeName: 'backgroundColor',
|
|
194
|
-
attributeValue: "'red'",
|
|
195
|
-
componentName: 'Chart.Line',
|
|
196
|
-
inlineStyleProps: 'style',
|
|
197
|
-
loc: 98,
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
attributeName: 'padding',
|
|
201
|
-
attributeValue: '10',
|
|
202
|
-
componentName: 'Chart.Line',
|
|
203
|
-
inlineStyleProps: 'style',
|
|
204
|
-
loc: 98,
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
attributeName: 'backgroundColor',
|
|
208
|
-
attributeValue: "'red'",
|
|
209
|
-
componentName: 'Chart.SelectAction',
|
|
210
|
-
inlineStyleProps: 'style',
|
|
211
|
-
loc: 107,
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
attributeName: 'padding',
|
|
215
|
-
attributeValue: '10',
|
|
216
|
-
componentName: 'Chart.SelectAction',
|
|
217
|
-
inlineStyleProps: 'style',
|
|
218
|
-
loc: 107,
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
attributeName: 'width',
|
|
222
|
-
attributeValue: '400',
|
|
223
|
-
componentName: 'Chart.SelectAction',
|
|
224
|
-
inlineStyleProps: 'style',
|
|
225
|
-
loc: 107,
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
attributeName: 'height',
|
|
229
|
-
attributeValue: "'100%'",
|
|
230
|
-
componentName: 'Chart.SelectAction',
|
|
231
|
-
inlineStyleProps: 'style',
|
|
232
|
-
loc: 107,
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
attributeName: 'padding',
|
|
236
|
-
attributeValue: '10',
|
|
237
|
-
componentName: 'FormGroup',
|
|
238
|
-
inlineStyleProps: 'style',
|
|
239
|
-
loc: 115,
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
attributeName: 'height',
|
|
243
|
-
attributeValue: '100',
|
|
244
|
-
componentName: 'FilterTrigger',
|
|
245
|
-
inlineStyleProps: 'style',
|
|
246
|
-
loc: 120,
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
attributeName: 'padding',
|
|
250
|
-
attributeValue: '10',
|
|
251
|
-
componentName: 'FilterTrigger',
|
|
252
|
-
inlineStyleProps: 'style',
|
|
253
|
-
loc: 120,
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
attributeName: 'height',
|
|
257
|
-
attributeValue: '100',
|
|
258
|
-
componentName: 'SegmentedControl',
|
|
259
|
-
inlineStyleProps: 'style',
|
|
260
|
-
loc: 128,
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
attributeName: 'padding',
|
|
264
|
-
attributeValue: '10',
|
|
265
|
-
componentName: 'SegmentedControl',
|
|
266
|
-
inlineStyleProps: 'style',
|
|
267
|
-
loc: 128,
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
it('reports correct snowflakes with flow files', () => {
|
|
273
|
-
const source = fs.readFileSync('./src/__mocks__/mobileSourceSample.js', 'utf-8');
|
|
274
|
-
expect((0, parseMobileSource_1.default)(source)).toEqual({
|
|
275
|
-
approvedLocs: [55, 57, 73, 82, 19],
|
|
276
|
-
styleLocs: [72, 76, 83, 49, 51, 52, 53, 54, 65, 67, 68, 69, 70, 71],
|
|
277
|
-
styledComponentLocs: [15, 24, 29],
|
|
278
|
-
violatingAttributes: [
|
|
279
|
-
{
|
|
280
|
-
attributeName: 'padding',
|
|
281
|
-
attributeValue: '20',
|
|
282
|
-
componentName: 'Button.Icon',
|
|
283
|
-
inlineStyleProps: 'style',
|
|
284
|
-
loc: 72,
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
attributeName: 'padding',
|
|
288
|
-
attributeValue: '20',
|
|
289
|
-
componentName: 'Button.Icon',
|
|
290
|
-
inlineStyleProps: 'style',
|
|
291
|
-
loc: 76,
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
attributeName: 'backgroundColor',
|
|
295
|
-
attributeValue: "'red'",
|
|
296
|
-
componentName: 'Button.Icon',
|
|
297
|
-
inlineStyleProps: 'style',
|
|
298
|
-
loc: 76,
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
attributeName: 'backgroundColor',
|
|
302
|
-
attributeValue: "'red'",
|
|
303
|
-
componentName: 'Button.Icon',
|
|
304
|
-
inlineStyleProps: 'style',
|
|
305
|
-
loc: 83,
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
attributeName: 'padding',
|
|
309
|
-
attributeValue: '10',
|
|
310
|
-
componentName: 'Tabs',
|
|
311
|
-
inlineStyleProps: 'barStyle',
|
|
312
|
-
loc: 49,
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
attributeName: 'width',
|
|
316
|
-
attributeValue: '100',
|
|
317
|
-
componentName: 'Tabs',
|
|
318
|
-
inlineStyleProps: 'containerStyle',
|
|
319
|
-
loc: 49,
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
attributeName: 'width',
|
|
323
|
-
attributeValue: '100',
|
|
324
|
-
componentName: 'Tabs.Scroll',
|
|
325
|
-
inlineStyleProps: 'containerStyle',
|
|
326
|
-
loc: 51,
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
attributeName: 'color',
|
|
330
|
-
attributeValue: "'red'",
|
|
331
|
-
componentName: 'TextInput',
|
|
332
|
-
inlineStyleProps: 'textStyle',
|
|
333
|
-
loc: 52,
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
attributeName: 'color',
|
|
337
|
-
attributeValue: "'red'",
|
|
338
|
-
componentName: 'Search.OneLine',
|
|
339
|
-
inlineStyleProps: 'textStyle',
|
|
340
|
-
loc: 53,
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
attributeName: 'borderColor',
|
|
344
|
-
attributeValue: "'red'",
|
|
345
|
-
componentName: 'Search.OneLine',
|
|
346
|
-
inlineStyleProps: 'textStyle',
|
|
347
|
-
loc: 53,
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
attributeName: 'color',
|
|
351
|
-
attributeValue: "'red'",
|
|
352
|
-
componentName: 'Toolbar.Message',
|
|
353
|
-
inlineStyleProps: 'textStyle',
|
|
354
|
-
loc: 54,
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
attributeName: 'borderColor',
|
|
358
|
-
attributeValue: "'red'",
|
|
359
|
-
componentName: 'Toolbar.Message',
|
|
360
|
-
inlineStyleProps: 'textStyle',
|
|
361
|
-
loc: 54,
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
attributeName: 'width',
|
|
365
|
-
attributeValue: '200',
|
|
366
|
-
componentName: 'Empty',
|
|
367
|
-
inlineStyleProps: 'style',
|
|
368
|
-
loc: 65,
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
attributeName: 'width',
|
|
372
|
-
attributeValue: '200',
|
|
373
|
-
componentName: 'Button.Utility',
|
|
374
|
-
inlineStyleProps: 'style',
|
|
375
|
-
loc: 67,
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
attributeName: 'padding',
|
|
379
|
-
attributeValue: '30',
|
|
380
|
-
componentName: 'Button',
|
|
381
|
-
inlineStyleProps: 'style',
|
|
382
|
-
loc: 68,
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
attributeName: 'padding',
|
|
386
|
-
attributeValue: '30',
|
|
387
|
-
componentName: 'Button',
|
|
388
|
-
inlineStyleProps: 'style',
|
|
389
|
-
loc: 69,
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
attributeName: 'padding',
|
|
393
|
-
attributeValue: '30',
|
|
394
|
-
componentName: 'Button',
|
|
395
|
-
inlineStyleProps: 'style',
|
|
396
|
-
loc: 70,
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
attributeName: 'padding',
|
|
400
|
-
attributeValue: '30',
|
|
401
|
-
componentName: 'Button',
|
|
402
|
-
inlineStyleProps: 'style',
|
|
403
|
-
loc: 71,
|
|
404
|
-
},
|
|
405
|
-
],
|
|
406
|
-
});
|
|
407
|
-
});
|
|
408
|
-
it('does not include approved snowflakes in the report', () => {
|
|
409
|
-
const source = fs.readFileSync('./src/__mocks__/mobileApprovalSourceSample.tsx', 'utf-8');
|
|
410
|
-
expect((0, parseMobileSource_1.default)(source)).toEqual({
|
|
411
|
-
approvedLocs: [14, 16, 7],
|
|
412
|
-
styleLocs: [],
|
|
413
|
-
styledComponentLocs: [],
|
|
414
|
-
violatingAttributes: [],
|
|
415
|
-
});
|
|
416
|
-
});
|
|
417
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
const fs = __importStar(require("fs"));
|
|
40
|
-
const parseSource_1 = __importDefault(require("../parseSource"));
|
|
41
|
-
describe('parseSource', () => {
|
|
42
|
-
it('reports correct snowflakes', () => {
|
|
43
|
-
const source = fs.readFileSync('./src/__mocks__/sourceSample.tsx', 'utf-8');
|
|
44
|
-
expect((0, parseSource_1.default)(source)).toEqual({
|
|
45
|
-
approvedLocs: [81, 101, 105, 112, 93, 103, 10],
|
|
46
|
-
classNameLocs: [66, 64, 65, 67, 68],
|
|
47
|
-
styleLocs: [78, 96, 107, 71, 73, 74, 75, 76, 77, 79, 80],
|
|
48
|
-
styledComponentLocs: [6, 15, 20, 24, 28],
|
|
49
|
-
sxLocs: [90, 114, 85, 86, 87, 88, 89, 91, 92],
|
|
50
|
-
violatingAttributes: [
|
|
51
|
-
{
|
|
52
|
-
attributeName: 'padding',
|
|
53
|
-
attributeValue: '20',
|
|
54
|
-
componentName: 'Button.Link',
|
|
55
|
-
inlineStyleProps: 'style',
|
|
56
|
-
loc: 78,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
attributeName: 'padding',
|
|
60
|
-
attributeValue: '20',
|
|
61
|
-
componentName: 'Button.Link',
|
|
62
|
-
inlineStyleProps: 'sx',
|
|
63
|
-
loc: 90,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
attributeName: 'padding',
|
|
67
|
-
attributeValue: '20',
|
|
68
|
-
componentName: 'Button.Link',
|
|
69
|
-
inlineStyleProps: 'style',
|
|
70
|
-
loc: 96,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
attributeName: 'backgroundColor',
|
|
74
|
-
attributeValue: "'red'",
|
|
75
|
-
componentName: 'Button.Link',
|
|
76
|
-
inlineStyleProps: 'style',
|
|
77
|
-
loc: 96,
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
attributeName: 'padding',
|
|
81
|
-
attributeValue: '20',
|
|
82
|
-
componentName: 'Button.Link',
|
|
83
|
-
inlineStyleProps: 'style',
|
|
84
|
-
loc: 107,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
attributeName: 'backgroundColor',
|
|
88
|
-
attributeValue: "'red'",
|
|
89
|
-
componentName: 'Button.Link',
|
|
90
|
-
inlineStyleProps: 'sx',
|
|
91
|
-
loc: 114,
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
attributeName: 'width',
|
|
95
|
-
attributeValue: '200',
|
|
96
|
-
componentName: 'Empty',
|
|
97
|
-
inlineStyleProps: 'style',
|
|
98
|
-
loc: 71,
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
attributeName: 'width',
|
|
102
|
-
attributeValue: '200',
|
|
103
|
-
componentName: 'Card.Header',
|
|
104
|
-
inlineStyleProps: 'style',
|
|
105
|
-
loc: 73,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
attributeName: 'padding',
|
|
109
|
-
attributeValue: '30',
|
|
110
|
-
componentName: 'Button',
|
|
111
|
-
inlineStyleProps: 'style',
|
|
112
|
-
loc: 74,
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
attributeName: 'padding',
|
|
116
|
-
attributeValue: '30',
|
|
117
|
-
componentName: 'Button',
|
|
118
|
-
inlineStyleProps: 'style',
|
|
119
|
-
loc: 75,
|
|
120
|
-
additionalProps: [
|
|
121
|
-
{
|
|
122
|
-
propName: 'variant',
|
|
123
|
-
propValue: '"text"',
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
attributeName: 'padding',
|
|
129
|
-
attributeValue: '30',
|
|
130
|
-
componentName: 'Button',
|
|
131
|
-
inlineStyleProps: 'style',
|
|
132
|
-
loc: 76,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
attributeName: 'padding',
|
|
136
|
-
attributeValue: '30',
|
|
137
|
-
componentName: 'Button',
|
|
138
|
-
inlineStyleProps: 'style',
|
|
139
|
-
loc: 77,
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
attributeName: 'margin',
|
|
143
|
-
attributeValue: '15',
|
|
144
|
-
componentName: 'Pane',
|
|
145
|
-
inlineStyleProps: 'style',
|
|
146
|
-
loc: 79,
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
attributeName: 'margin',
|
|
150
|
-
attributeValue: '20',
|
|
151
|
-
componentName: 'Pane.Body',
|
|
152
|
-
inlineStyleProps: 'style',
|
|
153
|
-
loc: 80,
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
attributeName: 'mt',
|
|
157
|
-
attributeValue: '10',
|
|
158
|
-
componentName: 'Badge.Count',
|
|
159
|
-
inlineStyleProps: 'sx',
|
|
160
|
-
loc: 85,
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
attributeName: 'pt',
|
|
164
|
-
attributeValue: '10',
|
|
165
|
-
componentName: 'Badge',
|
|
166
|
-
inlineStyleProps: 'sx',
|
|
167
|
-
loc: 86,
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
attributeName: 'pt',
|
|
171
|
-
attributeValue: '10',
|
|
172
|
-
componentName: 'Badge',
|
|
173
|
-
inlineStyleProps: 'sx',
|
|
174
|
-
loc: 87,
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
attributeName: 'pt',
|
|
178
|
-
attributeValue: '10',
|
|
179
|
-
componentName: 'Badge',
|
|
180
|
-
inlineStyleProps: 'sx',
|
|
181
|
-
loc: 88,
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
attributeName: 'pt',
|
|
185
|
-
attributeValue: '10',
|
|
186
|
-
componentName: 'Badge',
|
|
187
|
-
inlineStyleProps: 'sx',
|
|
188
|
-
loc: 89,
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
attributeName: 'margin',
|
|
192
|
-
attributeValue: '15',
|
|
193
|
-
componentName: 'Pane',
|
|
194
|
-
inlineStyleProps: 'sx',
|
|
195
|
-
loc: 91,
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
attributeName: 'margin',
|
|
199
|
-
attributeValue: '20',
|
|
200
|
-
componentName: 'Pane.Footer',
|
|
201
|
-
inlineStyleProps: 'sx',
|
|
202
|
-
loc: 92,
|
|
203
|
-
},
|
|
204
|
-
],
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const fetchGraphql_1 = __importDefault(require("../fetchGraphql"));
|
|
16
|
-
describe('fetchGraphql', () => {
|
|
17
|
-
it('calls fetch with correct arguments', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
process.env.SNOWFLAKE_GUARD_SECRET = 'secret';
|
|
19
|
-
const fetchMock = jest.spyOn(global, 'fetch').mockImplementation(jest.fn(() => Promise.resolve({
|
|
20
|
-
json: () => Promise.resolve({ data: 'response-data' }),
|
|
21
|
-
})));
|
|
22
|
-
const response = yield (0, fetchGraphql_1.default)('query');
|
|
23
|
-
expect(fetchMock).toHaveBeenCalledWith('http://localhost:3000/graphql', {
|
|
24
|
-
method: 'POST',
|
|
25
|
-
headers: {
|
|
26
|
-
'Content-Type': 'application/json',
|
|
27
|
-
'Snowflake-Guard-Auth': 'secret',
|
|
28
|
-
},
|
|
29
|
-
body: JSON.stringify({ query: 'query' }),
|
|
30
|
-
});
|
|
31
|
-
expect(response).toEqual({ data: 'response-data' });
|
|
32
|
-
}));
|
|
33
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|