added qUnit unit testing framework, started categories unit tests. finally out of MVP so time to unslackmode :)
parent
faf70d85d8
commit
69f1037d45
@ -0,0 +1,33 @@
|
||||
<h1>Categories Unit Tests</h1>
|
||||
<hr />
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
QUnit.init();
|
||||
asyncTest( "Loading Categories", function() {
|
||||
|
||||
jQuery.get(config.api_url + 'home', function(data) {
|
||||
ok( data.categories.length > 0, JSON.stringify(data.categories) );
|
||||
|
||||
start();
|
||||
|
||||
for (var i = 0, ii = data.categories.length; i < ii; i++) {
|
||||
var category = data.categories[i],
|
||||
slug = 'category/' + category.slug;
|
||||
|
||||
asyncTest( "Loading Category '" + category.name + "' located at " + slug, function() {
|
||||
jQuery.get(config.api_url + slug, function(data) {
|
||||
ok( data.category_name, JSON.stringify(data) ); //todo: check this against data.categories
|
||||
start();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.start();
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue