Skip to content

Commit

Permalink
test: import by .ts extension
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Apr 17, 2024
1 parent 8a9075a commit 18b91c1
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/web-components/test/display/display.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import '../installSesLockdown.js';
import { expect, test } from 'vitest';
import { parseAsValue } from '../../src/display/display.js';
import { parseAsValue } from '../../src/display/display.ts';

test(parseAsValue, () => {
expect(parseAsValue('30')).toBe(30n);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import '../../installSesLockdown.js';
import { describe, expect, it } from 'vitest';
import { captureNum } from '../../../src/display/natValue/helpers/captureNum.js';
import { captureNum } from '../../../src/display/natValue/helpers/captureNum.ts';

describe(captureNum, () => {
it('can capture positive numbers', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import '../../installSesLockdown.js';
import { describe, expect, it } from 'vitest';
import { parseAsNat } from '../../../src/display/natValue/parseAsNat.js';
import { parseAsNat } from '../../../src/display/natValue/parseAsNat.ts';

describe(parseAsNat, () => {
it('can parse cents to dollars', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import '../../installSesLockdown.js';
import { describe, expect, it } from 'vitest';
import { roundToDecimalPlaces as round } from '../../../src/display/natValue/helpers/roundToDecimalPlaces.js';
import { roundToDecimalPlaces as round } from '../../../src/display/natValue/helpers/roundToDecimalPlaces.ts';

describe(round, () => {
it('can round', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import '../../installSesLockdown.js';
import { describe, expect, it } from 'vitest';
import { stringifyNat } from '../../../src/display/natValue/stringifyNat.js';
import { stringifyNat } from '../../../src/display/natValue/stringifyNat.ts';

describe(stringifyNat, () => {
it('can stringify cents to dollars', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
stringifyRatio,
stringifyRatioAsFraction,
stringifyRatioAsPercent,
} from '../../../src/display/index.js';
import { makeRatio } from '../../../src/display/natValue/ratio.js';
} from '../../../src/display/index.ts';
import { makeRatio } from '../../../src/display/natValue/ratio.ts';

describe('stringifyRatio', () => {
const ethBrand = Far('eth brand', {});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import '../../installSesLockdown.js';
import { expect, test } from 'vitest';
import { stringifySet } from '../../../src/display/setValue/stringifySet.js';
import { stringifySet } from '../../../src/display/setValue/stringifySet.ts';

test(stringifySet, () => {
expect(stringifySet(['foo', 'bar'])).toBe('2');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import '../installSesLockdown.js';
import { describe, vi, expect, it } from 'vitest';
import { makeAgoricWalletConnection } from '../../src/wallet-connection/walletConnection.js';
import { makeAgoricWalletConnection } from '../../src/wallet-connection/walletConnection.ts';
import {
makeAgoricSigner,
// @ts-expect-error exported by mock below
Expand All @@ -10,8 +10,8 @@ import {
// @ts-expect-error exported by mock below
// eslint-disable-next-line import/named
provisionSmartWallet as mockProvisionSmartWallet,
} from '../../src/wallet-connection/makeAgoricSigner.js';
import { Errors } from '../../src/wallet-connection/errors.js';
} from '../../src/wallet-connection/makeAgoricSigner.ts';
import { Errors } from '../../src/wallet-connection/errors.ts';

const testAddress = 'agoric123test';
const rpc = 'https://fake.rpc';
Expand All @@ -20,7 +20,7 @@ const rpc = 'https://fake.rpc';
// eslint-disable-next-line no-undef
global.window = { keplr: {} };

vi.mock('../../src/wallet-connection/makeAgoricSigner.js', () => {
vi.mock('../../src/wallet-connection/makeAgoricSigner.ts', () => {
const submitSpendAction = vi.fn();
const provisionSmartWallet = vi.fn();

Expand All @@ -35,7 +35,7 @@ vi.mock('../../src/wallet-connection/makeAgoricSigner.js', () => {
};
});

vi.mock('../../src/queryBankBalances.js', () => {
vi.mock('../../src/queryBankBalances.ts', () => {
return {
queryBankBalances: vi.fn(),
};
Expand Down
1 change: 1 addition & 0 deletions packages/web-components/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"allowImportingTsExtensions": false,
"noEmit": false,
"declaration": true,
"declarationMap": true
Expand Down
1 change: 1 addition & 0 deletions packages/web-components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"allowImportingTsExtensions": true, // for tests
"outDir": "./dist",
"checkJs": true
},
Expand Down

0 comments on commit 18b91c1

Please sign in to comment.