@teleporthq/teleport-plugin-common 0.45.3-alpha.0 → 0.45.13
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/__tests__/builders/html-builders.ts +9 -2
- package/__tests__/builders/style-builders.ts +135 -1
- package/__tests__/node-handlers/node-to-html/index.ts +2 -0
- package/__tests__/node-handlers/node-to-jsx/attribute-value-mapper.ts +77 -0
- package/__tests__/node-handlers/node-to-jsx/calendar-events-reviver.ts +176 -0
- package/__tests__/node-handlers/node-to-jsx/chart-data-guard.ts +101 -0
- package/__tests__/node-handlers/node-to-jsx/cms-list-repeater-ecommerce-source.ts +79 -0
- package/__tests__/node-handlers/node-to-jsx/cms-list-repeater-loading.ts +122 -0
- package/__tests__/node-handlers/node-to-jsx/index.ts +719 -3
- package/__tests__/node-handlers/node-to-jsx/url-search-params-expression.ts +59 -0
- package/__tests__/node-handlers/node-to-jsx/utils.ts +635 -3
- package/__tests__/utils/ast-utils.ts +188 -0
- package/__tests__/utils/content-property-sanitiser.ts +156 -0
- package/__tests__/utils/page-seeds-state-from-data-source.ts +70 -0
- package/__tests__/utils/parse-string-with-template-expressions.ts +82 -0
- package/__tests__/utils/resource-auth-scheme.ts +55 -0
- package/__tests__/utils/route-utils.ts +118 -0
- package/__tests__/utils/style-utils.ts +59 -0
- package/__tests__/utils/template-expression-balance.ts +83 -0
- package/__tests__/utils/url-query-writer.ts +239 -0
- package/__tests__/utils/url-search-param-sync.ts +138 -0
- package/__tests__/utils/url-search-params.ts +48 -0
- package/dist/cjs/builders/ast-builders.d.ts +2 -0
- package/dist/cjs/builders/ast-builders.d.ts.map +1 -1
- package/dist/cjs/builders/ast-builders.js +41 -3
- package/dist/cjs/builders/ast-builders.js.map +1 -1
- package/dist/cjs/builders/hast-builders.d.ts +1 -0
- package/dist/cjs/builders/hast-builders.d.ts.map +1 -1
- package/dist/cjs/builders/hast-builders.js +11 -1
- package/dist/cjs/builders/hast-builders.js.map +1 -1
- package/dist/cjs/builders/style-builders.d.ts +8 -2
- package/dist/cjs/builders/style-builders.d.ts.map +1 -1
- package/dist/cjs/builders/style-builders.js +80 -33
- package/dist/cjs/builders/style-builders.js.map +1 -1
- package/dist/cjs/index.d.ts +5 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +10 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/node-handlers/node-to-html/constants.d.ts.map +1 -1
- package/dist/cjs/node-handlers/node-to-html/constants.js +2 -0
- package/dist/cjs/node-handlers/node-to-html/constants.js.map +1 -1
- package/dist/cjs/node-handlers/node-to-html/index.d.ts.map +1 -1
- package/dist/cjs/node-handlers/node-to-html/index.js +69 -1
- package/dist/cjs/node-handlers/node-to-html/index.js.map +1 -1
- package/dist/cjs/node-handlers/node-to-html/types.d.ts +5 -1
- package/dist/cjs/node-handlers/node-to-html/types.d.ts.map +1 -1
- package/dist/cjs/node-handlers/node-to-html/utils.d.ts +2 -1
- package/dist/cjs/node-handlers/node-to-html/utils.d.ts.map +1 -1
- package/dist/cjs/node-handlers/node-to-html/utils.js +174 -13
- package/dist/cjs/node-handlers/node-to-html/utils.js.map +1 -1
- package/dist/cjs/node-handlers/node-to-jsx/index.d.ts.map +1 -1
- package/dist/cjs/node-handlers/node-to-jsx/index.js +1443 -45
- package/dist/cjs/node-handlers/node-to-jsx/index.js.map +1 -1
- package/dist/cjs/node-handlers/node-to-jsx/types.d.ts +60 -6
- package/dist/cjs/node-handlers/node-to-jsx/types.d.ts.map +1 -1
- package/dist/cjs/node-handlers/node-to-jsx/utils.d.ts +80 -7
- package/dist/cjs/node-handlers/node-to-jsx/utils.d.ts.map +1 -1
- package/dist/cjs/node-handlers/node-to-jsx/utils.js +883 -72
- package/dist/cjs/node-handlers/node-to-jsx/utils.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/cjs/utils/ast-utils.d.ts +163 -11
- package/dist/cjs/utils/ast-utils.d.ts.map +1 -1
- package/dist/cjs/utils/ast-utils.js +1013 -75
- package/dist/cjs/utils/ast-utils.js.map +1 -1
- package/dist/cjs/utils/hast-utils.d.ts +8 -6
- package/dist/cjs/utils/hast-utils.d.ts.map +1 -1
- package/dist/cjs/utils/hast-utils.js +28 -4
- package/dist/cjs/utils/hast-utils.js.map +1 -1
- package/dist/cjs/utils/nested-selector-commas.d.ts +2 -0
- package/dist/cjs/utils/nested-selector-commas.d.ts.map +1 -0
- package/dist/cjs/utils/nested-selector-commas.js +81 -0
- package/dist/cjs/utils/nested-selector-commas.js.map +1 -0
- package/dist/cjs/utils/route-utils.d.ts +117 -0
- package/dist/cjs/utils/route-utils.d.ts.map +1 -0
- package/dist/cjs/utils/route-utils.js +212 -0
- package/dist/cjs/utils/route-utils.js.map +1 -0
- package/dist/cjs/utils/style-utils.d.ts +1 -0
- package/dist/cjs/utils/style-utils.d.ts.map +1 -1
- package/dist/cjs/utils/style-utils.js +181 -2
- package/dist/cjs/utils/style-utils.js.map +1 -1
- package/dist/cjs/utils/template-expression-balance.d.ts +58 -0
- package/dist/cjs/utils/template-expression-balance.d.ts.map +1 -0
- package/dist/cjs/utils/template-expression-balance.js +181 -0
- package/dist/cjs/utils/template-expression-balance.js.map +1 -0
- package/dist/cjs/utils/types.d.ts +3 -0
- package/dist/cjs/utils/types.d.ts.map +1 -0
- package/dist/cjs/utils/types.js +3 -0
- package/dist/cjs/utils/types.js.map +1 -0
- package/dist/cjs/utils/url-query-writer.d.ts +123 -0
- package/dist/cjs/utils/url-query-writer.d.ts.map +1 -0
- package/dist/cjs/utils/url-query-writer.js +260 -0
- package/dist/cjs/utils/url-query-writer.js.map +1 -0
- package/dist/cjs/utils/url-search-param-sync.d.ts +4 -0
- package/dist/cjs/utils/url-search-param-sync.d.ts.map +1 -0
- package/dist/cjs/utils/url-search-param-sync.js +241 -0
- package/dist/cjs/utils/url-search-param-sync.js.map +1 -0
- package/dist/cjs/utils/url-search-params.d.ts +48 -0
- package/dist/cjs/utils/url-search-params.d.ts.map +1 -0
- package/dist/cjs/utils/url-search-params.js +109 -0
- package/dist/cjs/utils/url-search-params.js.map +1 -0
- package/dist/esm/builders/ast-builders.d.ts +2 -0
- package/dist/esm/builders/ast-builders.d.ts.map +1 -1
- package/dist/esm/builders/ast-builders.js +40 -4
- package/dist/esm/builders/ast-builders.js.map +1 -1
- package/dist/esm/builders/hast-builders.d.ts +1 -0
- package/dist/esm/builders/hast-builders.d.ts.map +1 -1
- package/dist/esm/builders/hast-builders.js +9 -0
- package/dist/esm/builders/hast-builders.js.map +1 -1
- package/dist/esm/builders/style-builders.d.ts +8 -2
- package/dist/esm/builders/style-builders.d.ts.map +1 -1
- package/dist/esm/builders/style-builders.js +78 -32
- package/dist/esm/builders/style-builders.js.map +1 -1
- package/dist/esm/index.d.ts +5 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node-handlers/node-to-html/constants.d.ts.map +1 -1
- package/dist/esm/node-handlers/node-to-html/constants.js +2 -0
- package/dist/esm/node-handlers/node-to-html/constants.js.map +1 -1
- package/dist/esm/node-handlers/node-to-html/index.d.ts.map +1 -1
- package/dist/esm/node-handlers/node-to-html/index.js +71 -3
- package/dist/esm/node-handlers/node-to-html/index.js.map +1 -1
- package/dist/esm/node-handlers/node-to-html/types.d.ts +5 -1
- package/dist/esm/node-handlers/node-to-html/types.d.ts.map +1 -1
- package/dist/esm/node-handlers/node-to-html/utils.d.ts +2 -1
- package/dist/esm/node-handlers/node-to-html/utils.d.ts.map +1 -1
- package/dist/esm/node-handlers/node-to-html/utils.js +170 -13
- package/dist/esm/node-handlers/node-to-html/utils.js.map +1 -1
- package/dist/esm/node-handlers/node-to-jsx/index.d.ts.map +1 -1
- package/dist/esm/node-handlers/node-to-jsx/index.js +1442 -47
- package/dist/esm/node-handlers/node-to-jsx/index.js.map +1 -1
- package/dist/esm/node-handlers/node-to-jsx/types.d.ts +60 -6
- package/dist/esm/node-handlers/node-to-jsx/types.d.ts.map +1 -1
- package/dist/esm/node-handlers/node-to-jsx/utils.d.ts +80 -7
- package/dist/esm/node-handlers/node-to-jsx/utils.d.ts.map +1 -1
- package/dist/esm/node-handlers/node-to-jsx/utils.js +875 -70
- package/dist/esm/node-handlers/node-to-jsx/utils.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/utils/ast-utils.d.ts +163 -11
- package/dist/esm/utils/ast-utils.d.ts.map +1 -1
- package/dist/esm/utils/ast-utils.js +989 -75
- package/dist/esm/utils/ast-utils.js.map +1 -1
- package/dist/esm/utils/hast-utils.d.ts +8 -6
- package/dist/esm/utils/hast-utils.d.ts.map +1 -1
- package/dist/esm/utils/hast-utils.js +26 -3
- package/dist/esm/utils/hast-utils.js.map +1 -1
- package/dist/esm/utils/nested-selector-commas.d.ts +2 -0
- package/dist/esm/utils/nested-selector-commas.d.ts.map +1 -0
- package/dist/esm/utils/nested-selector-commas.js +77 -0
- package/dist/esm/utils/nested-selector-commas.js.map +1 -0
- package/dist/esm/utils/route-utils.d.ts +117 -0
- package/dist/esm/utils/route-utils.d.ts.map +1 -0
- package/dist/esm/utils/route-utils.js +179 -0
- package/dist/esm/utils/route-utils.js.map +1 -0
- package/dist/esm/utils/style-utils.d.ts +1 -0
- package/dist/esm/utils/style-utils.d.ts.map +1 -1
- package/dist/esm/utils/style-utils.js +179 -1
- package/dist/esm/utils/style-utils.js.map +1 -1
- package/dist/esm/utils/template-expression-balance.d.ts +58 -0
- package/dist/esm/utils/template-expression-balance.d.ts.map +1 -0
- package/dist/esm/utils/template-expression-balance.js +174 -0
- package/dist/esm/utils/template-expression-balance.js.map +1 -0
- package/dist/esm/utils/types.d.ts +3 -0
- package/dist/esm/utils/types.d.ts.map +1 -0
- package/dist/esm/utils/types.js +2 -0
- package/dist/esm/utils/types.js.map +1 -0
- package/dist/esm/utils/url-query-writer.d.ts +123 -0
- package/dist/esm/utils/url-query-writer.d.ts.map +1 -0
- package/dist/esm/utils/url-query-writer.js +229 -0
- package/dist/esm/utils/url-query-writer.js.map +1 -0
- package/dist/esm/utils/url-search-param-sync.d.ts +4 -0
- package/dist/esm/utils/url-search-param-sync.d.ts.map +1 -0
- package/dist/esm/utils/url-search-param-sync.js +213 -0
- package/dist/esm/utils/url-search-param-sync.js.map +1 -0
- package/dist/esm/utils/url-search-params.d.ts +48 -0
- package/dist/esm/utils/url-search-params.d.ts.map +1 -0
- package/dist/esm/utils/url-search-params.js +81 -0
- package/dist/esm/utils/url-search-params.js.map +1 -0
- package/package.json +4 -4
- package/src/builders/ast-builders.ts +80 -3
- package/src/builders/hast-builders.ts +11 -0
- package/src/builders/style-builders.ts +121 -43
- package/src/index.ts +22 -1
- package/src/node-handlers/node-to-html/constants.ts +2 -0
- package/src/node-handlers/node-to-html/index.ts +126 -6
- package/src/node-handlers/node-to-html/types.ts +6 -0
- package/src/node-handlers/node-to-html/utils.ts +228 -14
- package/src/node-handlers/node-to-jsx/index.ts +2135 -62
- package/src/node-handlers/node-to-jsx/types.ts +75 -32
- package/src/node-handlers/node-to-jsx/utils.ts +1173 -84
- package/src/utils/ast-utils.ts +1316 -127
- package/src/utils/hast-utils.ts +37 -9
- package/src/utils/nested-selector-commas.ts +88 -0
- package/src/utils/route-utils.ts +214 -0
- package/src/utils/style-utils.ts +183 -1
- package/src/utils/template-expression-balance.ts +196 -0
- package/src/utils/types.ts +25 -0
- package/src/utils/url-query-writer.ts +318 -0
- package/src/utils/url-search-param-sync.ts +303 -0
- package/src/utils/url-search-params.ts +122 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import generate from '@babel/generator'
|
|
1
2
|
import {
|
|
3
|
+
getExpressionFromUIDLExpressionNode,
|
|
2
4
|
stringAsTemplateLiteral,
|
|
3
5
|
addSpreadAttributeToJSXTag,
|
|
4
6
|
renameJSXTag,
|
|
@@ -8,6 +10,9 @@ import {
|
|
|
8
10
|
convertValueToLiteral,
|
|
9
11
|
objectToObjectExpression,
|
|
10
12
|
addRawAttributeToJSXTag,
|
|
13
|
+
collectGlobalReferencesFromObjectStates,
|
|
14
|
+
createStateHookAST,
|
|
15
|
+
sanitizeExprContent,
|
|
11
16
|
} from '../../src/utils/ast-utils'
|
|
12
17
|
import ParsedASTNode from '../../src/utils/parsed-ast'
|
|
13
18
|
import { createJSXTag } from '../../src/builders/ast-builders'
|
|
@@ -123,6 +128,24 @@ describe('addAttributeToJSXTag', () => {
|
|
|
123
128
|
})
|
|
124
129
|
})
|
|
125
130
|
|
|
131
|
+
describe('addAttributeToJSXTag with text a JSX attribute string cannot hold', () => {
|
|
132
|
+
it('keeps backslashes and line breaks exactly as written', () => {
|
|
133
|
+
const tag = createJSXTag('input')
|
|
134
|
+
const pattern = '[+0-9 \\(\\)\\-]{7,20}'
|
|
135
|
+
|
|
136
|
+
addAttributeToJSXTag(tag, 'pattern', pattern)
|
|
137
|
+
addAttributeToJSXTag(tag, 'title', 'first line\nsecond line')
|
|
138
|
+
|
|
139
|
+
const [patternAttr, titleAttr] = tag.openingElement.attributes as types.JSXAttribute[]
|
|
140
|
+
const patternValue = (patternAttr.value as types.JSXExpressionContainer)
|
|
141
|
+
.expression as types.StringLiteral
|
|
142
|
+
const titleValue = (titleAttr.value as types.JSXExpressionContainer)
|
|
143
|
+
.expression as types.StringLiteral
|
|
144
|
+
expect(patternValue.value).toBe(pattern)
|
|
145
|
+
expect(titleValue.value).toBe('first line\nsecond line')
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
|
|
126
149
|
describe('addRawAttributeToJSXTag', () => {
|
|
127
150
|
it('adds an attribute with string without encoding', () => {
|
|
128
151
|
const tag = createJSXTag('iframe')
|
|
@@ -284,3 +307,168 @@ describe('objectToObjectExpression', () => {
|
|
|
284
307
|
})
|
|
285
308
|
})
|
|
286
309
|
})
|
|
310
|
+
|
|
311
|
+
describe('collectGlobalReferencesFromObjectStates', () => {
|
|
312
|
+
it('resolves refPath-style global references (no explicit id) via GLOBAL_REF_ID_MAP', () => {
|
|
313
|
+
const stateDefinitions = {
|
|
314
|
+
profileViewer: {
|
|
315
|
+
type: 'object',
|
|
316
|
+
defaultValue: {
|
|
317
|
+
currentUserId: {
|
|
318
|
+
type: 'dynamic',
|
|
319
|
+
content: {
|
|
320
|
+
referenceType: 'global',
|
|
321
|
+
refPath: ['Current User', 'id'],
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
}
|
|
327
|
+
const refs = collectGlobalReferencesFromObjectStates(stateDefinitions as never)
|
|
328
|
+
expect(refs).toContain('currentUser')
|
|
329
|
+
})
|
|
330
|
+
|
|
331
|
+
it('resolves id-style global references untouched', () => {
|
|
332
|
+
const stateDefinitions = {
|
|
333
|
+
cartViewer: {
|
|
334
|
+
type: 'object',
|
|
335
|
+
defaultValue: {
|
|
336
|
+
itemCount: {
|
|
337
|
+
type: 'dynamic',
|
|
338
|
+
content: { referenceType: 'global', id: 'cart', refPath: ['items', 'length'] },
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
}
|
|
343
|
+
const refs = collectGlobalReferencesFromObjectStates(stateDefinitions as never)
|
|
344
|
+
expect(refs).toContain('cart')
|
|
345
|
+
})
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
describe('createStateHookAST – urlSearchParamBinding', () => {
|
|
349
|
+
const codeOf = (node: types.Node) => generate(node).code
|
|
350
|
+
|
|
351
|
+
it('emits plain useState(defaultValue) when no binding is declared', () => {
|
|
352
|
+
const decl = createStateHookAST('openPanel', {
|
|
353
|
+
type: 'boolean',
|
|
354
|
+
defaultValue: false,
|
|
355
|
+
})
|
|
356
|
+
expect(codeOf(decl)).toBe('const [openPanel, setOpenPanel] = useState(false);')
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
it('seeds useState from window.location.search falling back to the declared default', () => {
|
|
360
|
+
// Deliberately uses `window.location.search` rather than `router.query`
|
|
361
|
+
// because on SSG pages `router.query` is empty on the first render and
|
|
362
|
+
// only hydrates after `router.isReady` flips — past that, `useState`'s
|
|
363
|
+
// initializer has already captured the fallback default. Direct reads
|
|
364
|
+
// from `window.location.search` are synchronously available on both
|
|
365
|
+
// direct loads and client-side navigations.
|
|
366
|
+
const decl = createStateHookAST('products_detail_panel_item_id', {
|
|
367
|
+
type: 'string',
|
|
368
|
+
defaultValue: '',
|
|
369
|
+
urlSearchParamBinding: { key: 'products_detail_panel_item_id' },
|
|
370
|
+
})
|
|
371
|
+
expect(codeOf(decl)).toBe(
|
|
372
|
+
'const [products_detail_panel_item_id, setProductsDetailPanelItemId] = useState((typeof window !== "undefined" ? new URLSearchParams(window.location.search).get("products_detail_panel_item_id") : null) ?? "");'
|
|
373
|
+
)
|
|
374
|
+
})
|
|
375
|
+
|
|
376
|
+
it('falls back to a non-empty static default when the param is absent', () => {
|
|
377
|
+
const decl = createStateHookAST('category', {
|
|
378
|
+
type: 'string',
|
|
379
|
+
defaultValue: 'all',
|
|
380
|
+
urlSearchParamBinding: { key: 'category' },
|
|
381
|
+
})
|
|
382
|
+
expect(codeOf(decl)).toBe(
|
|
383
|
+
'const [category, setCategory] = useState((typeof window !== "undefined" ? new URLSearchParams(window.location.search).get("category") : null) ?? "all");'
|
|
384
|
+
)
|
|
385
|
+
})
|
|
386
|
+
|
|
387
|
+
it('keeps the static default on both sides when the binding asks to hydrate after mount', () => {
|
|
388
|
+
// A state that only changes how server-rendered markup LOOKS (the products
|
|
389
|
+
// list's grid/list toggle) must not be seeded from the URL on the client:
|
|
390
|
+
// React 17 does not patch attribute mismatches on hydration, so the
|
|
391
|
+
// toggle would keep the server's pressed state. The router read-back
|
|
392
|
+
// effect adopts the URL value after mount instead — a real update.
|
|
393
|
+
const decl = createStateHookAST('productsView', {
|
|
394
|
+
type: 'string',
|
|
395
|
+
defaultValue: 'grid',
|
|
396
|
+
urlSearchParamBinding: { key: 'view', hydrateAfterMount: true },
|
|
397
|
+
})
|
|
398
|
+
expect(codeOf(decl)).toBe('const [productsView, setProductsView] = useState("grid");')
|
|
399
|
+
})
|
|
400
|
+
|
|
401
|
+
it('ignores urlSearchParamBinding with an empty key (defensive)', () => {
|
|
402
|
+
const decl = createStateHookAST('foo', {
|
|
403
|
+
type: 'string',
|
|
404
|
+
defaultValue: 'x',
|
|
405
|
+
urlSearchParamBinding: { key: '' },
|
|
406
|
+
})
|
|
407
|
+
expect(codeOf(decl)).toBe('const [foo, setFoo] = useState("x");')
|
|
408
|
+
})
|
|
409
|
+
|
|
410
|
+
it('prefers dataSourceBinding over urlSearchParamBinding when both are declared', () => {
|
|
411
|
+
const decl = createStateHookAST('mixed', {
|
|
412
|
+
type: 'string',
|
|
413
|
+
defaultValue: 'fallback',
|
|
414
|
+
dataSourceBinding: { dataSourceId: 'ds', refPath: [] },
|
|
415
|
+
urlSearchParamBinding: { key: 'mixed' },
|
|
416
|
+
})
|
|
417
|
+
// dataSourceBinding path short-circuits: props.mixed !== undefined ? props.mixed : "fallback"
|
|
418
|
+
expect(codeOf(decl)).toBe(
|
|
419
|
+
'const [mixed, setMixed] = useState(props.mixed !== undefined ? props.mixed : "fallback");'
|
|
420
|
+
)
|
|
421
|
+
})
|
|
422
|
+
})
|
|
423
|
+
|
|
424
|
+
describe('sanitizeExprContent', () => {
|
|
425
|
+
const originalWarn = console.warn
|
|
426
|
+
beforeEach(() => {
|
|
427
|
+
console.warn = jest.fn()
|
|
428
|
+
})
|
|
429
|
+
afterEach(() => {
|
|
430
|
+
console.warn = originalWarn
|
|
431
|
+
})
|
|
432
|
+
|
|
433
|
+
it('passes through well-formed expressions unchanged', () => {
|
|
434
|
+
const expr = '`/profile/' + '$' + '{' + 'currentUser?.id}' + '`'
|
|
435
|
+
expect(sanitizeExprContent(expr, 'href')).toBe(expr)
|
|
436
|
+
expect((console.warn as jest.Mock).mock.calls.length).toBe(0)
|
|
437
|
+
})
|
|
438
|
+
|
|
439
|
+
it('repairs the /profile/${} My Profile navlink pattern', () => {
|
|
440
|
+
const expr = '`/profile/' + '$' + '{}' + '`'
|
|
441
|
+
expect(sanitizeExprContent(expr, 'href')).toBe(
|
|
442
|
+
'`/profile/' + '$' + '{' + 'currentUser?.id}' + '`'
|
|
443
|
+
)
|
|
444
|
+
expect((console.warn as jest.Mock).mock.calls.length).toBe(1)
|
|
445
|
+
})
|
|
446
|
+
|
|
447
|
+
it('repairs generic empty ${} with an empty-string placeholder', () => {
|
|
448
|
+
const expr = '`/unknown/' + '$' + '{}' + '/edit`'
|
|
449
|
+
expect(sanitizeExprContent(expr, 'href')).toBe(
|
|
450
|
+
'`/unknown/' + '$' + '{' + "'" + "'" + '}' + '/edit`'
|
|
451
|
+
)
|
|
452
|
+
expect((console.warn as jest.Mock).mock.calls.length).toBe(1)
|
|
453
|
+
})
|
|
454
|
+
})
|
|
455
|
+
|
|
456
|
+
describe('getExpressionFromUIDLExpressionNode — member reads never throw', () => {
|
|
457
|
+
const render = (content: string) =>
|
|
458
|
+
generate(getExpressionFromUIDLExpressionNode({ type: 'expr', content } as any)).code
|
|
459
|
+
|
|
460
|
+
it('turns an indexed path into an optional chain', () => {
|
|
461
|
+
expect(render("strengths[0].pillar || ''")).toBe("strengths?.[0]?.pillar || ''")
|
|
462
|
+
})
|
|
463
|
+
|
|
464
|
+
it("keeps a call's own member plain and guards what it reads from", () => {
|
|
465
|
+
expect(render('JSON.stringify(results.pillars)')).toBe('JSON.stringify(results?.pillars)')
|
|
466
|
+
expect(render('items.map(item => item.name)')).toBe('items.map(item => item?.name)')
|
|
467
|
+
})
|
|
468
|
+
|
|
469
|
+
it('leaves identifiers, literals and operators as written', () => {
|
|
470
|
+
expect(render("activeStep === 2 && industry !== ''")).toBe(
|
|
471
|
+
"activeStep === 2 && industry !== ''"
|
|
472
|
+
)
|
|
473
|
+
})
|
|
474
|
+
})
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { sanitizeContentValue, getContentOfStyleObject } from '../../src/utils/style-utils'
|
|
2
|
+
import { UIDLStyleDefinitions } from '@teleporthq/teleport-types'
|
|
3
|
+
|
|
4
|
+
// Regression guard for "broken CSS shipped to next dev as
|
|
5
|
+
// `content: ';;`". The AI occasionally emits the raw fragment
|
|
6
|
+
// `';` as the value of the `content` property — without
|
|
7
|
+
// sanitisation the JSS pipeline forwards it verbatim and the
|
|
8
|
+
// emitted rule becomes:
|
|
9
|
+
//
|
|
10
|
+
// .bundle-price-tag::before {
|
|
11
|
+
// content: ';; ← starts a quoted string that never closes
|
|
12
|
+
// }
|
|
13
|
+
//
|
|
14
|
+
// Next.js's CSS loader then bails on the entire stylesheet,
|
|
15
|
+
// which manifests in dev as a Webpack overlay and in prod as
|
|
16
|
+
// silently-missing rules from that point onward. The sanitiser
|
|
17
|
+
// keeps the surrounding rule parseable by either accepting a
|
|
18
|
+
// well-formed value as-is, normalising one of the canonical
|
|
19
|
+
// keyword/function shapes, or — when the input can't be repaired
|
|
20
|
+
// — substituting the empty-string literal `''`.
|
|
21
|
+
|
|
22
|
+
describe('sanitizeContentValue', () => {
|
|
23
|
+
it('keeps a properly single-quoted string as-is', () => {
|
|
24
|
+
expect(sanitizeContentValue("'★'")).toBe("'★'")
|
|
25
|
+
expect(sanitizeContentValue("'NEW'")).toBe("'NEW'")
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('keeps a properly double-quoted string as-is', () => {
|
|
29
|
+
expect(sanitizeContentValue('"foo"')).toBe('"foo"')
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('keeps the empty-string literal', () => {
|
|
33
|
+
expect(sanitizeContentValue("''")).toBe("''")
|
|
34
|
+
expect(sanitizeContentValue('""')).toBe('""')
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('keeps the canonical keywords', () => {
|
|
38
|
+
for (const kw of [
|
|
39
|
+
'none',
|
|
40
|
+
'normal',
|
|
41
|
+
'open-quote',
|
|
42
|
+
'close-quote',
|
|
43
|
+
'no-open-quote',
|
|
44
|
+
'no-close-quote',
|
|
45
|
+
'inherit',
|
|
46
|
+
'initial',
|
|
47
|
+
'unset',
|
|
48
|
+
'revert',
|
|
49
|
+
]) {
|
|
50
|
+
expect(sanitizeContentValue(kw)).toBe(kw)
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('keeps recognised function calls (attr / counter / var / url)', () => {
|
|
55
|
+
expect(sanitizeContentValue('attr(data-label)')).toBe('attr(data-label)')
|
|
56
|
+
expect(sanitizeContentValue('counter(section)')).toBe('counter(section)')
|
|
57
|
+
expect(sanitizeContentValue('var(--badge)')).toBe('var(--badge)')
|
|
58
|
+
expect(sanitizeContentValue('url(/icon.svg)')).toBe('url(/icon.svg)')
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it("repairs the canonical broken AI emission `';` to an empty string literal", () => {
|
|
62
|
+
// This is the specific shape that started this regression.
|
|
63
|
+
// The repair path strips the stray quote + semicolon and
|
|
64
|
+
// wraps the (empty) remainder, yielding a valid declaration.
|
|
65
|
+
expect(sanitizeContentValue("';")).toBe("''")
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('repairs other unquoted garbage to an empty string literal', () => {
|
|
69
|
+
expect(sanitizeContentValue(';')).toBe("''")
|
|
70
|
+
expect(sanitizeContentValue("'")).toBe("''")
|
|
71
|
+
expect(sanitizeContentValue('"')).toBe("''")
|
|
72
|
+
expect(sanitizeContentValue(' ')).toBe("''")
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('rejects strings whose quotes do not match or balance', () => {
|
|
76
|
+
// `'foo"` — opens with single, closes with double — is NOT a
|
|
77
|
+
// properly quoted string. We repair: strip stray quote
|
|
78
|
+
// characters, wrap the remaining bareword in single quotes.
|
|
79
|
+
expect(sanitizeContentValue('\'foo"')).toBe("'foo'")
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('rejects a string with an unescaped interior matching quote', () => {
|
|
83
|
+
// `'a'b'` — the closing quote in position 2 closes the
|
|
84
|
+
// string early, leaving `b'` as raw CSS. The sanitiser must
|
|
85
|
+
// refuse to treat this as a quoted string; instead it
|
|
86
|
+
// strips quotes and re-wraps.
|
|
87
|
+
expect(sanitizeContentValue("'a'b'")).toBe("'ab'")
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it('preserves an escaped interior quote in a single-quoted string', () => {
|
|
91
|
+
// The walker honours `\` as an escape, so a backslash-escaped
|
|
92
|
+
// single quote inside a single-quoted string is part of the
|
|
93
|
+
// content, not a terminator.
|
|
94
|
+
expect(sanitizeContentValue("'don\\'t'")).toBe("'don\\'t'")
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
it('preserves a value that contains a colon inside a quoted string', () => {
|
|
98
|
+
// The generic `isValidCSSValue` would otherwise drop a colon
|
|
99
|
+
// outside parentheses, but content values are passed straight
|
|
100
|
+
// through to the sanitiser instead — a colon in a quoted
|
|
101
|
+
// string is legitimate text.
|
|
102
|
+
expect(sanitizeContentValue('"section:1"')).toBe('"section:1"')
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
it('does not silently mangle a long quoted string', () => {
|
|
106
|
+
// A real-world bundle-price decoration like `'$ '` must
|
|
107
|
+
// round-trip unchanged.
|
|
108
|
+
expect(sanitizeContentValue("'$ '")).toBe("'$ '")
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
describe('getContentOfStyleObject: integration with content sanitiser', () => {
|
|
113
|
+
it('applies the sanitiser only to the `content` key', () => {
|
|
114
|
+
const styleValue: UIDLStyleDefinitions = {
|
|
115
|
+
content: { type: 'static', content: "';" },
|
|
116
|
+
color: { type: 'static', content: 'red' },
|
|
117
|
+
'font-family': { type: 'static', content: "'Arial', sans-serif" },
|
|
118
|
+
}
|
|
119
|
+
const result = getContentOfStyleObject(styleValue)
|
|
120
|
+
// `content` is repaired; `color` and `font-family` are
|
|
121
|
+
// unaffected (the latter accidentally matches the "quoted"
|
|
122
|
+
// pattern but is on a different key, so it never reaches the
|
|
123
|
+
// sanitiser).
|
|
124
|
+
expect(result.content).toBe("''")
|
|
125
|
+
expect(result.color).toBe('red')
|
|
126
|
+
expect(result['font-family']).toBe("'Arial', sans-serif")
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
it('repairs the documented bundle-price-tag::before regression', () => {
|
|
130
|
+
// Mirrors the exact shape that produced
|
|
131
|
+
// `.bundle-price-tag::before { content: ';; }` in the
|
|
132
|
+
// generated stylesheet — verify end-to-end that the value
|
|
133
|
+
// that reaches downstream serializers is now `''`.
|
|
134
|
+
const styleValue: UIDLStyleDefinitions = {
|
|
135
|
+
content: { type: 'static', content: "';" },
|
|
136
|
+
}
|
|
137
|
+
expect(getContentOfStyleObject(styleValue)).toEqual({ content: "''" })
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
it('keeps a legitimate content value intact', () => {
|
|
141
|
+
const styleValue: UIDLStyleDefinitions = {
|
|
142
|
+
content: { type: 'static', content: "'★'" },
|
|
143
|
+
}
|
|
144
|
+
expect(getContentOfStyleObject(styleValue)).toEqual({ content: "'★'" })
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
it('keeps the existing colon-in-CSS-value guard for non-content properties', () => {
|
|
148
|
+
// Verifies the original `isValidCSSValue` check still rejects
|
|
149
|
+
// a corrupted background / etc. — the new key-aware branch
|
|
150
|
+
// only bypasses the colon check for `content`.
|
|
151
|
+
const styleValue: UIDLStyleDefinitions = {
|
|
152
|
+
background: { type: 'static', content: 'redcolor: blue' },
|
|
153
|
+
}
|
|
154
|
+
expect(getContentOfStyleObject(styleValue)).toEqual({})
|
|
155
|
+
})
|
|
156
|
+
})
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
pageSeedsStateFromDataSource,
|
|
3
|
+
stateQueryHasTemplatePlaceholder,
|
|
4
|
+
} from '../../src/utils/route-utils'
|
|
5
|
+
|
|
6
|
+
const DS_ID = 'ds-1'
|
|
7
|
+
const dataSources = { [DS_ID]: { id: DS_ID, type: 'teleport', config: {} } }
|
|
8
|
+
|
|
9
|
+
const state = (overrides: Record<string, unknown> = {}) => ({
|
|
10
|
+
type: 'array',
|
|
11
|
+
defaultValue: [] as unknown[],
|
|
12
|
+
dataSourceBinding: { dataSourceId: DS_ID, refPath: ['customers'] },
|
|
13
|
+
...overrides,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
describe('stateQueryHasTemplatePlaceholder', () => {
|
|
17
|
+
it('finds a placeholder anywhere in the query', () => {
|
|
18
|
+
expect(
|
|
19
|
+
stateQueryHasTemplatePlaceholder(
|
|
20
|
+
state({ query: "SELECT * FROM t WHERE user_id = '{{Current User.id}}'" })
|
|
21
|
+
)
|
|
22
|
+
).toBe(true)
|
|
23
|
+
expect(stateQueryHasTemplatePlaceholder(state({ query: 'SELECT {{ a.b }}' }))).toBe(true)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('is false for a plain query, an empty one and no query at all', () => {
|
|
27
|
+
expect(stateQueryHasTemplatePlaceholder(state({ query: 'SELECT COUNT(*) FROM t' }))).toBe(false)
|
|
28
|
+
expect(stateQueryHasTemplatePlaceholder(state({ query: '' }))).toBe(false)
|
|
29
|
+
expect(stateQueryHasTemplatePlaceholder(state())).toBe(false)
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
describe('pageSeedsStateFromDataSource', () => {
|
|
34
|
+
it('is true for a state bound to a table or to a placeholder-free raw query', () => {
|
|
35
|
+
expect(pageSeedsStateFromDataSource({ stateDefinitions: { rows: state() } }, dataSources)).toBe(
|
|
36
|
+
true
|
|
37
|
+
)
|
|
38
|
+
expect(
|
|
39
|
+
pageSeedsStateFromDataSource(
|
|
40
|
+
{ stateDefinitions: { total: state({ query: 'SELECT COUNT(*) AS value FROM t' }) } },
|
|
41
|
+
dataSources
|
|
42
|
+
)
|
|
43
|
+
).toBe(true)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('is false for a query only the browser can resolve', () => {
|
|
47
|
+
expect(
|
|
48
|
+
pageSeedsStateFromDataSource(
|
|
49
|
+
{
|
|
50
|
+
stateDefinitions: {
|
|
51
|
+
rows: state({ query: "SELECT * FROM t WHERE user_id = '{{Current User.id}}'" }),
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
dataSources
|
|
55
|
+
)
|
|
56
|
+
).toBe(false)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('is false without a binding, without states or without the bound data source', () => {
|
|
60
|
+
expect(
|
|
61
|
+
pageSeedsStateFromDataSource(
|
|
62
|
+
{ stateDefinitions: { search: { type: 'string', defaultValue: '' } } },
|
|
63
|
+
dataSources
|
|
64
|
+
)
|
|
65
|
+
).toBe(false)
|
|
66
|
+
expect(pageSeedsStateFromDataSource({}, dataSources)).toBe(false)
|
|
67
|
+
expect(pageSeedsStateFromDataSource({ stateDefinitions: { rows: state() } }, {})).toBe(false)
|
|
68
|
+
expect(pageSeedsStateFromDataSource({ stateDefinitions: { rows: state() } })).toBe(false)
|
|
69
|
+
})
|
|
70
|
+
})
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as types from '@babel/types'
|
|
2
|
+
import generate from '@babel/generator'
|
|
3
|
+
import { parseStringWithTemplateExpressions } from '../../src/utils/ast-utils'
|
|
4
|
+
|
|
5
|
+
/** The generated source for a template literal, e.g. "`translateX(${x}px)`". */
|
|
6
|
+
const render = (input: string): string =>
|
|
7
|
+
generate(parseStringWithTemplateExpressions(input) as types.Node).code
|
|
8
|
+
|
|
9
|
+
describe('parseStringWithTemplateExpressions', () => {
|
|
10
|
+
it('converts a well-formed binding and strips the state prefix', () => {
|
|
11
|
+
expect(render(`translate({{ enemy.x || '0' }}px)`)).toBe(`\`translate(\${enemy.x || '0'}px)\``)
|
|
12
|
+
expect(render(`translateX({{ -(state.cameraX || 0) }}px)`)).toBe(
|
|
13
|
+
`\`translateX(\${-(cameraX || 0)}px)\``
|
|
14
|
+
)
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('handles several bindings in one value', () => {
|
|
18
|
+
expect(render(`translate({{ ctx.x }}px, {{ ctx.y }}px)`)).toBe(
|
|
19
|
+
`\`translate(\${ctx.x}px, \${ctx.y}px)\``
|
|
20
|
+
)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('re-closes a CSS function the binding genuinely swallowed', () => {
|
|
24
|
+
// The unit is inferred from the one already present.
|
|
25
|
+
expect(render(`translate({{ x }}px, {{ y`)).toBe(`\`translate(\${x}px, \${y}px)\``)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('infers deg for rotate and no unit for scale', () => {
|
|
29
|
+
expect(render(`rotate({{ a`)).toBe(`\`rotate(\${a}deg)\``)
|
|
30
|
+
expect(render(`scale({{ s`)).toBe(`\`scale(\${s})\``)
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Run 021fa45a — an upstream "repair" turned `{{ -(state.cameraX || 0) }}` into
|
|
36
|
+
* `{{ -(state.cameraX || '' }}`, dropping the closing paren. This function then
|
|
37
|
+
* counted parentheses across the WHOLE string, mistook the imbalance inside the
|
|
38
|
+
* interpolation for an unclosed CSS function, appended `px)` to the end, and
|
|
39
|
+
* handed Babel `` `translateX(${-(cameraX || ''}px) }px)` ``. The SyntaxError
|
|
40
|
+
* escaped through the inline-style caller (which has no try/catch) and killed
|
|
41
|
+
* the entire project build.
|
|
42
|
+
*/
|
|
43
|
+
describe('parseStringWithTemplateExpressions — a malformed binding must not break the build', () => {
|
|
44
|
+
const BROKEN = `translateX({{ -(state.cameraX || '' }}px) }`
|
|
45
|
+
|
|
46
|
+
it('does not throw on the exact UIDL value that killed the build', () => {
|
|
47
|
+
expect(() => parseStringWithTemplateExpressions(BROKEN)).not.toThrow()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('repairs it INSIDE the interpolation, where the paren was missing', () => {
|
|
51
|
+
expect(render(BROKEN)).toBe(`\`translateX(\${-(cameraX || '')}px) }\``)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('no longer appends a fabricated unit and paren to the end', () => {
|
|
55
|
+
expect(render(BROKEN)).not.toContain('px)`')
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('closes an unterminated quote inside a binding', () => {
|
|
59
|
+
expect(render(`{{ label || 'Guest }}`)).toBe(`\`\${label || 'Guest'}\``)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('degrades to the declared literal fallback when nothing can be parsed', () => {
|
|
63
|
+
// A stray closer cannot be balanced without guessing, so the binding is
|
|
64
|
+
// dropped and its literal fallback kept — one value degrades, nothing throws.
|
|
65
|
+
const result = render(`{{ name) || 'Guest' }}`)
|
|
66
|
+
expect(result).toBe('`Guest`')
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('degrades to empty text when a broken binding declared no fallback', () => {
|
|
70
|
+
expect(render(`{{ a) }}`)).toBe('``')
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('always returns a TemplateLiteral, even on the degraded path', () => {
|
|
74
|
+
expect(types.isTemplateLiteral(parseStringWithTemplateExpressions(`{{ a) }}`))).toBe(true)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it('is idempotent on an already-repaired value', () => {
|
|
78
|
+
const once = render(BROKEN)
|
|
79
|
+
// Feeding the generated form back in (minus the backticks) is stable.
|
|
80
|
+
expect(render(once.slice(1, -1))).toBe(once)
|
|
81
|
+
})
|
|
82
|
+
})
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import generator from '@babel/generator'
|
|
2
|
+
import * as types from '@babel/types'
|
|
3
|
+
import { generateRemoteResourceASTs } from '../../src/utils/ast-utils'
|
|
4
|
+
import type { UIDLResourceItem } from '@teleporthq/teleport-types'
|
|
5
|
+
|
|
6
|
+
// Renders the statements produced for a resource fetcher into a code string so
|
|
7
|
+
// we can assert the exact Authorization header that ends up in the generated
|
|
8
|
+
// project.
|
|
9
|
+
const renderResource = (resource: UIDLResourceItem): string => {
|
|
10
|
+
const statements = generateRemoteResourceASTs(resource) as types.Statement[]
|
|
11
|
+
const program = types.program(statements)
|
|
12
|
+
return generator(program).code
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const baseResource = (headers: UIDLResourceItem['headers']): UIDLResourceItem => ({
|
|
16
|
+
name: 'CmsResource',
|
|
17
|
+
path: {
|
|
18
|
+
baseUrl: { type: 'env', content: 'CMS_URL' },
|
|
19
|
+
route: { type: 'static', content: 'api/Portfolio' },
|
|
20
|
+
},
|
|
21
|
+
method: 'GET',
|
|
22
|
+
headers,
|
|
23
|
+
response: { type: 'none' },
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
describe('resource Authorization header — auth scheme', () => {
|
|
27
|
+
it('defaults to `Bearer ` when no authScheme is set (Contentful/Strapi/Flotiq/Caisy)', () => {
|
|
28
|
+
const code = renderResource(
|
|
29
|
+
baseResource({ authToken: { type: 'env', content: 'CMS_ACCESS_TOKEN' } })
|
|
30
|
+
)
|
|
31
|
+
expect(code).toContain(`Authorization: \`Bearer \${process.env.CMS_ACCESS_TOKEN}\``)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('uses a custom scheme prefix from headers.authScheme (WordPress Basic auth)', () => {
|
|
35
|
+
const code = renderResource(
|
|
36
|
+
baseResource({
|
|
37
|
+
authToken: { type: 'env', content: 'CMS_ACCESS_TOKEN' },
|
|
38
|
+
authScheme: { type: 'static', content: 'Basic ' },
|
|
39
|
+
})
|
|
40
|
+
)
|
|
41
|
+
// No double scheme — the token is the base64 credential, prefixed with `Basic `.
|
|
42
|
+
expect(code).toContain(`Authorization: \`Basic \${process.env.CMS_ACCESS_TOKEN}\``)
|
|
43
|
+
expect(code).not.toContain('Bearer ')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('never emits authScheme as its own HTTP header', () => {
|
|
47
|
+
const code = renderResource(
|
|
48
|
+
baseResource({
|
|
49
|
+
authToken: { type: 'env', content: 'CMS_ACCESS_TOKEN' },
|
|
50
|
+
authScheme: { type: 'static', content: 'Basic ' },
|
|
51
|
+
})
|
|
52
|
+
)
|
|
53
|
+
expect(code).not.toContain('authScheme')
|
|
54
|
+
})
|
|
55
|
+
})
|