Skip to content

Commit 496f5b3

Browse files
committed
fix: replace dynamic ESM imports with static imports and fix error type assertions in coverageGaps.spec.ts
1 parent 5fb8a75 commit 496f5b3

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

packages/client/tests/specs/coverageGaps.spec.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919

2020
import {
2121
createSession,
22+
createViewport,
2223
del,
2324
destroySession,
25+
destroyViewport,
2426
editSimple,
2527
EditStats,
2628
getChangeCount,
@@ -29,6 +31,7 @@ import {
2931
getSegment,
3032
getSessionCount,
3133
getUndoCount,
34+
getViewportData,
3235
insert,
3336
IOFlags,
3437
overwrite,
@@ -316,9 +319,6 @@ describe('Coverage Gaps', () => {
316319

317320
describe('Viewport data integrity', () => {
318321
it('Should have viewport data matching session segment', async () => {
319-
const { createViewport, destroyViewport, getViewportData } =
320-
await import('@omega-edit/client')
321-
322322
const session_id = await createTestSession(testPort)
323323
await insert(session_id, 0, Buffer.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ'))
324324

@@ -350,9 +350,6 @@ describe('Coverage Gaps', () => {
350350
})
351351

352352
it('Should have viewport data matching after edits', async () => {
353-
const { createViewport, destroyViewport, getViewportData } =
354-
await import('@omega-edit/client')
355-
356353
const session_id = await createTestSession(testPort)
357354
await insert(session_id, 0, Buffer.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ'))
358355

@@ -391,7 +388,7 @@ describe('Coverage Gaps', () => {
391388
await getComputedFileSize(badId)
392389
expect.fail('Should have thrown an error')
393390
} catch (err: any) {
394-
expect(err).to.be.a('string')
391+
expect(err).to.be.an.instanceOf(Error)
395392
}
396393
})
397394

@@ -402,7 +399,7 @@ describe('Coverage Gaps', () => {
402399
await insert(badId, 0, Buffer.from('data'))
403400
expect.fail('Should have thrown an error')
404401
} catch (err: any) {
405-
expect(err).to.be.a('string')
402+
expect(err).to.be.an.instanceOf(Error)
406403
}
407404
})
408405

@@ -413,7 +410,7 @@ describe('Coverage Gaps', () => {
413410
await del(badId, 0, 5)
414411
expect.fail('Should have thrown an error')
415412
} catch (err: any) {
416-
expect(err).to.be.a('string')
413+
expect(err).to.be.an.instanceOf(Error)
417414
}
418415
})
419416

@@ -450,7 +447,7 @@ describe('Coverage Gaps', () => {
450447
await destroySession('does-not-exist-99999')
451448
expect.fail('Should have thrown an error')
452449
} catch (err: any) {
453-
expect(err).to.be.a('string')
450+
expect(err).to.be.an.instanceOf(Error)
454451
}
455452
})
456453
})

0 commit comments

Comments
 (0)