forked from knaxus/problem-solving-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweave.test.js
More file actions
27 lines (22 loc) · 680 Bytes
/
Copy pathweave.test.js
File metadata and controls
27 lines (22 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const { weaveQueues } = require('.');
const Queue = require('../index');
describe('Weave two queues using weaveQueues()', () => {
it('Should weave be a function', () => {
expect(typeof weaveQueues).toEqual('function');
});
it('Should weave 2 queues', () => {
const q1 = new Queue();
const q2 = new Queue();
q1.enqueue('Hello');
q2.enqueue(1);
q1.enqueue('World');
q2.enqueue(2);
q2.enqueue(3);
const q3 = weaveQueues(q1, q2);
expect(q3.dequeue()).toEqual('Hello');
expect(q3.dequeue()).toEqual(1);
expect(q3.dequeue()).toEqual('World');
expect(q3.dequeue()).toEqual(2);
expect(q3.dequeue()).toEqual(3);
});
});