Skip to content

Commit

Permalink
fix: Remove Cannot resolve symbol from the integration tests in v2 (#…
Browse files Browse the repository at this point in the history
…6737)

Co-authored-by: wuls <[email protected]>
  • Loading branch information
JerryWu1234 and wuls authored Jul 30, 2024
1 parent 3e940b7 commit 5ed507e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 33 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@
"start": "concurrently \"npm:build.watch\" \"npm:tsc.watch\" -n build,tsc -c green,cyan",
"test": "pnpm build.full && pnpm test.unit && pnpm test.e2e",
"test.e2e": "pnpm test.e2e.chromium && pnpm test.e2e.webkit",
"test.e2e.cli": "tsm scripts/e2e-cli.ts",
"test.e2e.chromium": "playwright test starters --browser=chromium --config starters/playwright.config.ts",
"test.e2e.chromium.debug": "PWDEBUG=1 playwright test starters --browser=chromium --config starters/playwright.config.ts",
"test.e2e.city": "playwright test starters/e2e/qwikcity --browser=chromium --config starters/playwright.config.ts",
"test.e2e.cli": "tsm scripts/e2e-cli.ts",
"test.e2e.firefox": "playwright test starters --browser=firefox --config starters/playwright.config.ts",
"test.e2e.webkit": "playwright test starters --browser=webkit --config starters/playwright.config.ts",
"test.rust": "make test",
Expand Down
63 changes: 31 additions & 32 deletions packages/qwik/src/core/v2/tests/render-api.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,20 @@ vi.hoisted(() => {
vi.stubGlobal('QWIK_LOADER_DEFAULT_DEBUG', 'debug');
});

const mapping = {
click: 'click.js',
s_counter: 's_counter.js',
s_click: 's_click.js',
};

const defaultManifest: QwikManifest = {
manifestHash: 'manifest-hash',
symbols: {},
bundles: {},
mapping: {},
mapping,
version: '1',
};

const defaultCounterManifest: QwikManifest = {
...defaultManifest,
mapping: {
click: 'click.js',
},
};

const ManyEventsComponent = component$(() => {
useOn(
'focus',
Expand Down Expand Up @@ -268,18 +267,20 @@ describe('render api', () => {
});

it('should escape invalid characters', async () => {
const Cmp = component$(() => {
const obj = {
a: '123',
b: '<script />',
c: '&foo',
};
return (
<div data-amp="foo&bar" data-lt="foo<bar" data-gt="foo>bar" data-a='"' data-b="'">
{JSON.stringify(obj)}
</div>
);
});
const Cmp = componentQrl(
inlinedQrl(() => {
const obj = {
a: '123',
b: '<script />',
c: '&foo',
};
return (
<div data-amp="foo&bar" data-lt="foo<bar" data-gt="foo>bar" data-a='"' data-b="'">
{JSON.stringify(obj)}
</div>
);
}, 's_counter')
);
const result = await renderToStringAndSetPlatform(<Cmp />, {
containerTagName: 'div',
manifest: defaultManifest,
Expand Down Expand Up @@ -504,7 +505,7 @@ describe('render api', () => {
prefetchStrategy: {
symbolsToPrefetch: 'auto',
},
manifest: defaultCounterManifest,
manifest: defaultManifest,
});
expect(result.prefetchResources).toEqual(expect.any(Array));
const document = createDocument(result.html);
Expand All @@ -522,7 +523,7 @@ describe('render api', () => {
linkInsert: 'html-append',
},
},
manifest: defaultCounterManifest,
manifest: defaultManifest,
});
const document = createDocument(result.html);
expect(document.querySelectorAll('script[q\\:type=prefetch-bundles]')).toHaveLength(1);
Expand All @@ -539,7 +540,7 @@ describe('render api', () => {
linkInsert: 'js-append',
},
},
manifest: defaultCounterManifest,
manifest: defaultManifest,
});
const document = createDocument(result.html);
expect(document.querySelectorAll('script[q\\:type=prefetch-bundles]')).toHaveLength(1);
Expand All @@ -559,7 +560,7 @@ describe('render api', () => {
linkRel: 'modulepreload',
},
},
manifest: defaultCounterManifest,
manifest: defaultManifest,
});
const document = createDocument(result.html);
expect(document.querySelectorAll('script[q\\:type=prefetch-bundles]')).toHaveLength(1);
Expand All @@ -577,7 +578,7 @@ describe('render api', () => {
linkRel: 'modulepreload',
},
},
manifest: defaultCounterManifest,
manifest: defaultManifest,
});
const document = createDocument(result.html);
expect(document.querySelectorAll('script[q\\:type=prefetch-bundles]')).toHaveLength(1);
Expand All @@ -597,7 +598,7 @@ describe('render api', () => {
linkRel: 'preload',
},
},
manifest: defaultCounterManifest,
manifest: defaultManifest,
});
const document = createDocument(result.html);
expect(document.querySelectorAll('script[q\\:type=prefetch-bundles]')).toHaveLength(1);
Expand All @@ -615,7 +616,7 @@ describe('render api', () => {
linkRel: 'preload',
},
},
manifest: defaultCounterManifest,
manifest: defaultManifest,
});
const document = createDocument(result.html);
expect(document.querySelectorAll('script[q\\:type=prefetch-bundles]')).toHaveLength(1);
Expand All @@ -634,7 +635,7 @@ describe('render api', () => {
prefetchEvent: null,
},
},
manifest: defaultCounterManifest,
manifest: defaultManifest,
});
const document = createDocument(result.html);
expect(document.querySelectorAll('script[q\\:type=prefetch-bundles]')).toHaveLength(0);
Expand All @@ -651,7 +652,7 @@ describe('render api', () => {
workerFetchInsert: 'always',
},
},
manifest: defaultCounterManifest,
manifest: defaultManifest,
});
const document = createDocument(result.html);
expect(document.querySelectorAll('script[q\\:type=prefetch-bundles]')).toHaveLength(1);
Expand Down Expand Up @@ -772,9 +773,7 @@ describe('render api', () => {
dynamicImports: [],
},
},
mapping: {
counter: 'counter.js',
},
mapping,
version: '1',
};
const result = await renderToStringAndSetPlatform(<Counter />, {
Expand Down

0 comments on commit 5ed507e

Please sign in to comment.