Skip to content

Commit 072d113

Browse files
committed
Updates test types
1 parent cad54c0 commit 072d113

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

packages/gen-mapping/test/gen-mapping.test.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
setIgnore,
1414
setRangeSegment,
1515
} from '../src/gen-mapping';
16+
import type { DecodedSourceMap, EncodedSourceMap } from '@jridgewell/trace-mapping';
1617

1718
describe('GenMapping', () => {
1819
describe('toDecodedMap', () => {
@@ -503,118 +504,118 @@ describe('GenMapping', () => {
503504

504505
describe('fromMap', () => {
505506
it('copies version', () => {
506-
const input = /** @type {import('@jridgewell/trace-mapping').DecodedSourceMap} */ {
507+
const input = {
507508
version: 3,
508509
names: [],
509510
sources: ['input.js'],
510511
sourcesContent: [],
511512
mappings: [],
512-
};
513+
} satisfies DecodedSourceMap;
513514
const map = fromMap(input);
514515

515516
assert.equal(toDecodedMap(map).version, 3);
516517
});
517518

518519
it('copies file name', () => {
519-
const input = /** @type {import('@jridgewell/trace-mapping').DecodedSourceMap} */ {
520+
const input = {
520521
version: 3,
521522
file: 'output.js',
522523
names: [],
523524
sources: ['input.js'],
524525
sourcesContent: [],
525526
mappings: [],
526-
};
527+
} satisfies DecodedSourceMap;
527528
const map = fromMap(input);
528529

529530
assert.equal(toDecodedMap(map).file, 'output.js');
530531
});
531532

532533
it('copies sourceRoot', () => {
533-
const input = /** @type {import('@jridgewell/trace-mapping').DecodedSourceMap} */ {
534+
const input = {
534535
version: 3,
535536
names: [],
536537
sourceRoot: 'foo/',
537538
sources: ['input.js'],
538539
sourcesContent: [],
539540
mappings: [],
540-
};
541+
} satisfies DecodedSourceMap;
541542
const map = fromMap(input);
542543

543544
assert.equal(toDecodedMap(map).sourceRoot, 'foo/');
544545
});
545546

546547
it('copies sources', () => {
547-
const input = /** @type {import('@jridgewell/trace-mapping').DecodedSourceMap} */ {
548+
const input = {
548549
version: 3,
549550
names: [],
550551
sources: ['input.js'],
551552
sourcesContent: [],
552553
mappings: [],
553-
};
554+
} satisfies DecodedSourceMap;
554555
const map = fromMap(input);
555556

556557
assert.deepEqual(toDecodedMap(map).sources, ['input.js']);
557558
});
558559

559560
it('copies sourcesContent', () => {
560-
const input = /** @type {import('@jridgewell/trace-mapping').DecodedSourceMap} */ {
561+
const input = {
561562
version: 3,
562563
names: [],
563564
sources: ['input.js'],
564565
sourcesContent: ['input'],
565566
mappings: [],
566-
};
567+
} satisfies DecodedSourceMap;
567568
const map = fromMap(input);
568569

569570
assert.deepEqual(toDecodedMap(map).sourcesContent, ['input']);
570571
});
571572

572573
it('creates sourcesContent', () => {
573-
const input = /** @type {import('@jridgewell/trace-mapping').DecodedSourceMap} */ {
574+
const input = {
574575
version: 3,
575576
names: [],
576577
sources: ['input.js'],
577578
mappings: [],
578-
};
579+
} satisfies DecodedSourceMap;
579580
const map = fromMap(input);
580581

581582
assert.deepEqual(toDecodedMap(map).sourcesContent, [null]);
582583
});
583584

584585
it('copies names', () => {
585-
const input = /** @type {import('@jridgewell/trace-mapping').DecodedSourceMap} */ {
586+
const input = {
586587
version: 3,
587588
names: ['foo'],
588589
sources: ['input.js'],
589590
sourcesContent: [],
590591
mappings: [[[0, 0, 0, 0, 0]]],
591-
};
592+
} satisfies DecodedSourceMap;
592593
const map = fromMap(input);
593594

594595
assert.deepEqual(toDecodedMap(map).names, ['foo']);
595596
});
596597

597598
it('copies decoded mappings', () => {
598-
const input = /** @type {import('@jridgewell/trace-mapping').DecodedSourceMap} */ {
599+
const input = {
599600
version: 3,
600601
names: [],
601602
sources: ['input.js'],
602603
sourcesContent: [],
603604
mappings: [[[1, 0, 2, 3, 0]]],
604-
};
605+
} satisfies DecodedSourceMap;
605606
const map = fromMap(input);
606607

607608
assert.deepEqual(toDecodedMap(map).mappings, [[[1, 0, 2, 3, 0]]]);
608609
});
609610

610611
it('copies encoded mappings', () => {
611-
const input = /** @type {import('@jridgewell/trace-mapping').EncodedSourceMap} */ {
612+
const input = {
612613
version: 3,
613614
names: [],
614615
sources: ['input.js'],
615616
sourcesContent: [],
616617
mappings: 'CAEGA',
617-
};
618+
} satisfies EncodedSourceMap;
618619
const map = fromMap(input);
619620

620621
assert.deepEqual(toDecodedMap(map).mappings, [[[1, 0, 2, 3, 0]]]);

0 commit comments

Comments
 (0)