Skip to content

Commit 86eb426

Browse files
committed
test uses public API
1 parent 352d913 commit 86eb426

File tree

12 files changed

+27
-21
lines changed

12 files changed

+27
-21
lines changed

src/algorithms/sorting/sorting.spec.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
/*eslint-disable */
1+
const {
2+
selectionSort, insertionSort, bubbleSort, mergeSort, quickSort,
3+
} = require('../../index');
4+
25
const sortingAlgorithms = [
3-
require('./selection-sort'),
4-
require('./insertion-sort'),
5-
require('./bubble-sort'),
6-
require('./merge-sort'),
7-
require('./quick-sort'),
6+
selectionSort,
7+
insertionSort,
8+
bubbleSort,
9+
mergeSort,
10+
quickSort,
811
];
912

1013
sortingAlgorithms.forEach((sort) => {

src/data-structures/graphs/graph.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Graph = require('./graph');
1+
const { Graph } = require('../../index');
22

33
describe('Graph', () => {
44
let graph;

src/data-structures/linked-lists/linked-list.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const LinkedList = require('./linked-list');
1+
const { LinkedList } = require('../../index');
22

33
describe('LinkedList Test', () => {
44
let linkedList;

src/data-structures/maps/hash-maps/hash-map.spec.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
const HashMap = require('./hash-map');
2-
// import HashMap from './hash-map';
1+
const { HashMap } = require('../../../index');
32

43

54
describe('HashMap Tests', () => {

src/data-structures/maps/map.spec.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
const HashMap = require('./hash-maps/hash-map');
2-
const TreeMap = require('./tree-maps/tree-map');
1+
const { HashMap, TreeMap } = require('../../index');
32

43
const mapImplementations = [
54
Map,

src/data-structures/queues/queue.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Queue = require('./queue.js');
1+
const { Queue } = require('../../index');
22

33
describe('Queue', () => {
44
let queue;

src/data-structures/sets/set.spec.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
const ArraySet = require('./array-set');
2-
const HashSet = require('./hash-set');
3-
const MapSet = require('./map-set');
4-
const TreeSet = require('./tree-set');
1+
const {
2+
ArraySet, HashSet, MapSet, TreeSet,
3+
} = require('../../index');
54

65
const setImplementations = [Set, HashSet, TreeSet, MapSet, ArraySet];
76

src/data-structures/stacks/stack.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Stack = require('./stack.js');
1+
const { Stack } = require('../../index');
22

33
describe('Stack', () => {
44
let stack;

src/data-structures/trees/binary-search-tree.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const BinarySearchTree = require('./binary-search-tree');
1+
const { BinarySearchTree } = require('../../index');
22

33
describe('Binary Search Tree', () => {
44
let bst;

src/data-structures/trees/binary-tree-node.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const BinaryTreeNode = require('./binary-tree-node');
1+
const { BinaryTreeNode } = require('../../index');
22

33
describe('Binary Tree Node', () => {
44
let treeNode;

src/data-structures/trees/red-black-tree.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const RedBlackTree = require('./red-black-tree.js');
1+
const { RedBlackTree } = require('../../index');
22

33
const { RED, BLACK } = RedBlackTree;
44

src/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ const HashMap = require('./data-structures/maps/hash-maps/hash-map');
77
const TreeMap = require('./data-structures/maps/tree-maps/tree-map');
88
const HashSet = require('./data-structures/sets/hash-set');
99
const TreeSet = require('./data-structures/sets/tree-set');
10+
const ArraySet = require('./data-structures/sets/array-set');
11+
const MapSet = require('./data-structures/sets/map-set');
1012
const BinarySearchTree = require('./data-structures/trees/binary-search-tree');
13+
const BinaryTreeNode = require('./data-structures/trees/binary-tree-node');
1114
const AvlTree = require('./data-structures/trees/avl-tree');
1215
const RedBlackTree = require('./data-structures/trees/red-black-tree');
1316
const LRUCache = require('./data-structures/custom/lru-cache');
@@ -27,7 +30,10 @@ module.exports = {
2730
TreeMap,
2831
HashSet,
2932
TreeSet,
33+
ArraySet,
34+
MapSet,
3035
BinarySearchTree,
36+
BinaryTreeNode,
3137
AvlTree,
3238
RedBlackTree,
3339
LRUCache,

0 commit comments

Comments
 (0)