Skip to content

Commit f827f33

Browse files
Copilotjirimoravcik
andcommitted
Fix TypeScript imports in tests - use static import instead of dynamic
Co-authored-by: jirimoravcik <951187+jirimoravcik@users.noreply.github.com>
1 parent 95d90bd commit f827f33

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

test/core/session_pool/session_pool.test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Configuration, EventType, KeyValueStore, Session, SessionPool } from '@crawlee/core';
1+
import { Configuration, EventType, KeyValueStore, Session, SessionPool, SessionPoolReuseStrategy } from '@crawlee/core';
22
import { entries } from '@crawlee/utils';
33
import { MemoryStorageEmulator } from 'test/shared/MemoryStorageEmulator';
44

@@ -440,7 +440,6 @@ describe('SessionPool - testing session pool', () => {
440440

441441
describe('Session reuse strategies', () => {
442442
test('ROUND_ROBIN should distribute sessions evenly', async () => {
443-
const { SessionPoolReuseStrategy } = await import('@crawlee/core');
444443
sessionPool = await SessionPool.open({
445444
maxPoolSize: 3,
446445
sessionPoolReuseStrategy: SessionPoolReuseStrategy.ROUND_ROBIN,
@@ -466,7 +465,6 @@ describe('SessionPool - testing session pool', () => {
466465
});
467466

468467
test('USE_UNTIL_FAILURE should reuse same session until it fails', async () => {
469-
const { SessionPoolReuseStrategy } = await import('@crawlee/core');
470468
sessionPool = await SessionPool.open({
471469
maxPoolSize: 5,
472470
sessionPoolReuseStrategy: SessionPoolReuseStrategy.USE_UNTIL_FAILURE,
@@ -498,7 +496,6 @@ describe('SessionPool - testing session pool', () => {
498496
});
499497

500498
test('LEAST_RECENTLY_USED should pick least recently used session', async () => {
501-
const { SessionPoolReuseStrategy } = await import('@crawlee/core');
502499
sessionPool = await SessionPool.open({
503500
maxPoolSize: 3,
504501
sessionPoolReuseStrategy: SessionPoolReuseStrategy.LEAST_RECENTLY_USED,
@@ -537,7 +534,6 @@ describe('SessionPool - testing session pool', () => {
537534
});
538535

539536
test('RANDOM should pick sessions randomly (default behavior)', async () => {
540-
const { SessionPoolReuseStrategy } = await import('@crawlee/core');
541537
sessionPool = await SessionPool.open({
542538
maxPoolSize: 10,
543539
sessionPoolReuseStrategy: SessionPoolReuseStrategy.RANDOM,
@@ -578,7 +574,6 @@ describe('SessionPool - testing session pool', () => {
578574
});
579575

580576
test('lastUsedAt should be persisted and restored', async () => {
581-
const { SessionPoolReuseStrategy } = await import('@crawlee/core');
582577
sessionPool = await SessionPool.open({
583578
maxPoolSize: 2,
584579
sessionPoolReuseStrategy: SessionPoolReuseStrategy.LEAST_RECENTLY_USED,

0 commit comments

Comments
 (0)