Skip to content

Commit c909776

Browse files
committed
Exported missing types
1 parent 96ae408 commit c909776

File tree

7 files changed

+101
-0
lines changed

7 files changed

+101
-0
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Exported missing types
13+
14+
### Added
15+
16+
- Added some unit tests
17+
1018
## [2.0.2] - 2024-05-13
1119

1220
### Fixed

src/dataStructure/index.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { describe, it, expect, vitest } from 'vitest';
2+
import * as index from './index.js';
3+
4+
vitest.mock('./DoublyLinkedList.js', () => ({
5+
dll: 'DoublyLinkedList',
6+
}));
7+
vitest.mock('./HashTable.js', () => ({ ht: 'HashTable' }));
8+
9+
describe('dataStructure:index', () => {
10+
describe('happy path', () => {
11+
it('should export only this', () => {
12+
const normalized = Object.entries(index).reduce<Record<string | number, unknown>>(
13+
(acc, [key, value]: [string, unknown]) => {
14+
if (typeof key !== 'symbol') {
15+
acc[key] = value;
16+
}
17+
return acc;
18+
},
19+
{},
20+
);
21+
expect(normalized).toEqual({
22+
dll: 'DoublyLinkedList',
23+
ht: 'HashTable',
24+
});
25+
});
26+
});
27+
});

src/engines/index.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { describe, it, expect, vitest } from 'vitest';
2+
import * as index from './index.js';
3+
4+
vitest.mock('./LeastFrequentlyUsed.ts', () => ({
5+
lfu: 'LeastFrequentlyUsed',
6+
}));
7+
vitest.mock('./LeastRecentlyUsed.js', () => ({ lru: 'LeastRecentlyUsed' }));
8+
9+
describe('dataStructure:index', () => {
10+
describe('happy path', () => {
11+
it('should export only this', () => {
12+
const normalized = Object.entries(index).reduce<Record<string | number, unknown>>(
13+
(acc, [key, value]: [string, unknown]) => {
14+
if (typeof key !== 'symbol') {
15+
acc[key] = value;
16+
}
17+
return acc;
18+
},
19+
{},
20+
);
21+
expect(normalized).toEqual({
22+
lfu: 'LeastFrequentlyUsed',
23+
lru: 'LeastRecentlyUsed',
24+
});
25+
});
26+
});
27+
});

src/index.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { describe, it, expect, vitest } from 'vitest';
2+
import * as index from './index.js';
3+
4+
vitest.mock('./cache.js', () => ({
5+
createCache: 'cache',
6+
}));
7+
vitest.mock('./enums/index.js', () => ({
8+
enums: 'enums',
9+
}));
10+
11+
describe('dataStructure:index', () => {
12+
describe('happy path', () => {
13+
it('should export only this', () => {
14+
const normalized = Object.entries(index).reduce<Record<string | number, unknown>>(
15+
(acc, [key, value]: [string, unknown]) => {
16+
if (typeof key !== 'symbol') {
17+
acc[key] = value;
18+
}
19+
return acc;
20+
},
21+
{},
22+
);
23+
expect(normalized).toEqual({
24+
enums: 'enums',
25+
createCache: 'cache',
26+
default: 'cache',
27+
});
28+
});
29+
});
30+
});

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { createCache } from './cache.js';
22

3+
export type * from './dataStructure/index.js';
4+
export type * from './engines/index.js';
5+
export * from './enums/index.js';
6+
export type * from './types/index.js';
7+
38
export { createCache };
49
export default createCache;

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type * from './Cache.js';

vitest.config.mts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ export default defineConfig({
1111
outputFile: './junit.xml',
1212
exclude: ['node_modules', 'build', '.idea', '.git', '.cache'],
1313
passWithNoTests: true,
14+
chaiConfig: {
15+
truncateThreshold: 1000,
16+
},
1417
},
1518
});

0 commit comments

Comments
 (0)