Skip to content

Commit

Permalink
Update twtl
Browse files Browse the repository at this point in the history
  • Loading branch information
padolsey committed Nov 3, 2012
1 parent fecb14c commit b76eddd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
44 changes: 22 additions & 22 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module('Programmatic', function() {
test('Programmatic', function() {

module('Substrings - testing index[0]', function(){
test('Substrings - testing index[0]', function(){

var unsorted = [],
strings = 'foo ggg hhh aaa jjj bar ... mim mam ham jam kam'.split(' ');
Expand All @@ -19,9 +19,9 @@ module('Programmatic', function() {

});

module('101', function() {
test('101', function() {

module('Basic first-character ordering', function(){
test('Basic first-character ordering', function(){

var unsorted = ['Paul', 'Michael'],
sorted = relevancy.sort(unsorted.slice(), 'M');
Expand All @@ -30,7 +30,7 @@ module('101', function() {

});

module('No matching items', function() {
test('No matching items', function() {

var unsorted = ['aaa', 'bbb', 'ccc'],
sorted = relevancy.sort(unsorted.slice(), 'x');
Expand All @@ -39,7 +39,7 @@ module('101', function() {

});

module('Some matching items', function(){
test('Some matching items', function(){

var unsorted = ['Sarah', 'Julie', 'Michael', 'Paul', 'Amanada'],
sorted = relevancy.sort(unsorted.slice(), 'M');
Expand All @@ -48,7 +48,7 @@ module('101', function() {

});

module('Items containing matches', function(){
test('Items containing matches', function(){

var unsorted = ['AAAA', 'ABBA', 'CCCC', 'CBBC'],
sorted = relevancy.sort(unsorted.slice(), 'BB');
Expand All @@ -57,7 +57,7 @@ module('101', function() {

});

module('Distance-from-start', function(){
test('Distance-from-start', function(){

var unsorted = ['..a', '.a', '....a', 'a', '...a'],
sorted = relevancy.sort(unsorted.slice(), 'a');
Expand All @@ -68,9 +68,9 @@ module('101', function() {

});

module('Real world examples', function() {
test('Real world examples', function() {

module('Basic names - ^Ja', function(){
test('Basic names - ^Ja', function(){

var unsorted = [
'John',
Expand Down Expand Up @@ -105,7 +105,7 @@ module('Real world examples', function() {

});

module('Full names', function(){
test('Full names', function(){

var unsorted = [
'John Smith',
Expand All @@ -131,7 +131,7 @@ module('Full names', function(){

});

module('Countries - single full', function(){
test('Countries - single full', function(){

expect(relevancy.sort(countries, 'GB')[0]).toEqual(['GB', 'United Kingdom']);
expect(relevancy.sort(countries, 'United States')[0]).toEqual(['US', 'United States']);
Expand All @@ -140,23 +140,23 @@ module('Countries - single full', function(){

});

module('Countries - single partial', function(){
test('Countries - single partial', function(){

var sorted = relevancy.sort(countries, 'Ukr');

expect(sorted[0]).toEqual(['UA', 'Ukraine']);

});

module('Countries - single partial - second word', function(){
test('Countries - single partial - second word', function(){

var sorted = relevancy.sort(countries, 'Poly');

expect(sorted[0]).toEqual(['PF', 'French Polynesia']);

});

module('Full sentences', function(){
test('Full sentences', function(){

var unsorted = [
'There are only 76 bottles of wine left',
Expand Down Expand Up @@ -190,9 +190,9 @@ module('Full sentences', function(){

})

module('subArrayWeightOperations (max, min, avg, custom', function() {
test('subArrayWeightOperations (max, min, avg, custom', function() {

module('max [default]', function(){
test('max [default]', function(){

// `max` is default

Expand All @@ -212,7 +212,7 @@ module('subArrayWeightOperations (max, min, avg, custom', function() {

});

module('custom - sub arrays', function(){
test('custom - sub arrays', function(){

var unsorted = [
['a', 'aa', 'aa'],
Expand All @@ -236,7 +236,7 @@ module('subArrayWeightOperations (max, min, avg, custom', function() {

});

module('custom - sub objects', function(){
test('custom - sub objects', function(){
var unsorted = [
{name: 'John'},
{name: 'Janet'},
Expand Down Expand Up @@ -279,9 +279,9 @@ module('subArrayWeightOperations (max, min, avg, custom', function() {

});

module('Misc. configs', function() {
test('Misc. configs', function() {

module('Basic names - Custom secondary comparator (retain index)', function(){
test('Basic names - Custom secondary comparator (retain index)', function(){

// It's possible to specify the secondary comparator used when
// weights are found to be equal. relevancy.js will attempt
Expand Down Expand Up @@ -334,7 +334,7 @@ module('Misc. configs', function() {

});

module('Custom bound - camelCase', function(){
test('Custom bound - camelCase', function(){

var array = [
'Script',
Expand Down
8 changes: 4 additions & 4 deletions test/twtl.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@
expect: function(v) {
return new AssertionSet(v);
},
module: function(m, fn) {
twtl[_console].group('Module: ' + m);
test: function(m, fn) {
twtl[_console].group('Test: ' + m);
var c = twtl.failures;
fn();
if (twtl.failures === c) {
twtl[_console].log('100% Pass');
}
twtl[_console].groupEnd('Module: ' + m);
twtl[_console].groupEnd('Test: ' + m);
},
failures: 0
};
Expand All @@ -158,7 +158,7 @@
c.groupEnd = c.groupEnd || String;

global.expect = twtl.expect;
global.module = twtl.module;
global.test = twtl.test;
twtl.augment = augment;

// Save the ending line of this very script
Expand Down

0 comments on commit b76eddd

Please sign in to comment.