Skip to content

Commit

Permalink
ci: add typings tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wellwelwel committed Jul 15, 2024
1 parent f3791c8 commit 0a4b0be
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
3 changes: 3 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"rules": {
"nursery": {
"useTopLevelRegex": "off"
},
"correctness": {
"noNodejsModules": "off"
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import type { Profiles } from './@types/profiles.js';

export declare const proxyBundle: Profiles;

declare const profiles: Profiles;

declare module 'aws-ssl-profiles' {
export = profiles;
export const proxyBundle: Profiles;
}

export default profiles;
4 changes: 2 additions & 2 deletions test/e2e/import.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { test, strict } from 'poku';
import awsCaBundle, { proxyBundle } from '../../lib/index.js';

test('Testing import (ESM)', () => {
strict(typeof awsCaBundle?.ca?.length === 'number');
strict(typeof proxyBundle?.ca?.length === 'number');
strict(typeof awsCaBundle?.ca?.length === 'number', 'Default import');
strict(typeof proxyBundle?.ca?.length === 'number', '"proxyBundle" import');
});
4 changes: 2 additions & 2 deletions test/e2e/require.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const awsCaBundle = require('../../lib/index.js');
const { proxyBundle } = require('../../lib/index.js');

test('Testing require (CJS)', () => {
strict(typeof awsCaBundle?.ca?.length === 'number');
strict(typeof proxyBundle?.ca?.length === 'number');
strict(typeof awsCaBundle?.ca?.length === 'number', 'Default require');
strict(typeof proxyBundle?.ca?.length === 'number', '"proxyBundle" require');
});
9 changes: 9 additions & 0 deletions test/e2e/typings.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { test, strict } from 'poku';
import { readFile } from 'node:fs/promises';

test('Ensure index.d.ts Typings', async () => {
const src = await readFile('./src/index.d.ts', 'utf-8');
const lib = await readFile('./lib/index.d.ts', 'utf-8');

strict.strictEqual(src, lib, '"src" and "lib" should be the same the same');
});

0 comments on commit 0a4b0be

Please sign in to comment.