Navigation Menu

Skip to content

Commit

Permalink
Update LinkedLists
Browse files Browse the repository at this point in the history
  • Loading branch information
rrgayhart committed Oct 7, 2016
1 parent f99ad3b commit b624699
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 32 deletions.
Empty file.
32 changes: 32 additions & 0 deletions linked_lists/javascript/ListNode_test.js
@@ -0,0 +1,32 @@
describe('ListNode', function() {
it('should have a data property', function(){
var node = new ListNode();
expect(node).to.have.property('data');
});

// it('should have data', function() {
// var node = new ListNode('info');
// expect(node.data).to.eq('info');
// var pizzaNode = new ListNode('pizza');
// expect(pizzaNode.data).to.eq('pizza');
// });

// it('should have a default empty nextNode', function() {
// var node = new ListNode('pizza');
// expect(node.nextNode).to.eq(null);
// });

// it('should allow setting a nextNode', function() {
// var n1 = new ListNode('pizza');
// var n2 = new ListNode('cats');
// n1.nextNode = n2;
// expect(n1.nextNode.data).to.eq('cats');
// expect(n1.nextNode instanceof ListNode).to.be.true;
// });

// it('should allow a next node argument on creation', function(){
// var node = new ListNode('pizza', new ListNode('cats'));
// expect(node.nextNode.data).to.eq('cats');
// expect(node.nextNode instanceof ListNode).to.be.true;
// });
});
8 changes: 5 additions & 3 deletions linked_lists/javascript/README.md
@@ -1,7 +1,9 @@
# Linked List Problem

## Running the Tests
Open the `test.html` page to see your tests run in the brower.

You can run the tests in this folder in the browser.
There are two sets of tests to get passing!

To run in the browser, open the `index.html` page and you should see your tests.
Start with the tests in `ListNode_test.js`

Once those are passing, more on to the tests in `LinkedList_test.js`
26 changes: 0 additions & 26 deletions linked_lists/javascript/linkedList_test.js
@@ -1,29 +1,3 @@
describe('ListNode', function() {
it('should have data', function() {
var node = new ListNode('pizza');
expect(node.data).to.eq('pizza');
});

it.skip('should have a default empty nextNode', function() {
var node = new ListNode('pizza');
expect(node.nextNode).to.eq(null);
});

it.skip('should allow setting a nextNode', function() {
var n1 = new ListNode('pizza');
var n2 = new ListNode('cats');
n1.nextNode = n2;
expect(n1.nextNode.data).to.eq('cats');
expect(n1.nextNode instanceof ListNode).to.be.true;
});

it.skip('should allow a next node argument on creation', function(){
var node = new ListNode('pizza', new ListNode('cats'));
expect(node.nextNode.data).to.eq('cats');
expect(node.nextNode instanceof ListNode).to.be.true;
});
});

describe('LinkedList', function() {
var list;

Expand Down
Expand Up @@ -14,10 +14,12 @@
<script src="../../_vendor/chai.js"></script>

<script>mocha.setup('bdd'); var expect = chai.expect;</script>

<script src="ListNode.js"></script>
<script src="LinkedList.js"></script>

<script src="linkedList.js"></script>

<script src="linkedList_test.js"></script>
<script src="ListNode_test.js"></script>
<script src="LinkedList_test.js"></script>
<script>mocha.run();</script>
</body>
</html>

0 comments on commit b624699

Please sign in to comment.