Browse Source

Travis goodness

Kirollos Risk 5 years ago
parent
commit
49855e2fc6
5 changed files with 33 additions and 3 deletions
  1. 1 1
      .gitignore
  2. 3 0
      .travis.yml
  3. 6 1
      package.json
  4. 23 0
      test/fuse-test.js
  5. 0 1
      test/index.html

+ 1 - 1
.gitignore

@@ -1,4 +1,4 @@
 node_modules/
-
+test/index.html
 .DS_Store
 .idea

+ 3 - 0
.travis.yml

@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+   - 0.6

+ 6 - 1
package.json

@@ -4,10 +4,15 @@
   "version": "1.0.0",
   "description": "Lightweight fuzzy-search",
   "license": "Apache",
-  "contributors": ["CatTail"],
   "main": "fuse.js",
   "repository": "https://github.com/krisk/Fuse.git",
   "dependencies": {
     "grunt-bump": "0.0.11"
+  },
+  "scripts": {
+    "test": "vows --spec"
+  },
+  "devDependencies": {
+    "vows": "0.6.x"
   }
 }

+ 23 - 0
test/fuse-test.js

@@ -0,0 +1,23 @@
+var assert = require('assert'),
+  vows = require('vows'),
+  Fuse = require('../fuse'),
+  books = require('./books.json');
+
+var pages = ["Apple", "Orange", "Banana"];
+var fuse = new Fuse(pages)
+console.log(pages);
+var f = fuse.search("ple");
+console.log("len:", f.length);
+
+// BASIC TESTS
+vows.describe('Basic Instantiation').addBatch({
+  'When initializing a Fiber class via <Fiber.extend>': {
+    topic: function() {
+      var f = fuse.search("ple");
+      return f;
+    },
+    'the <init> function should execute': function(result) {
+      assert.equal(result.length, 1);
+    }
+  }
+}).export(module);

+ 0 - 1
test/index.html

@@ -23,7 +23,6 @@ var options = {
 
 var fuse = new Fuse(pages, options)
 fuse.search("ora")
-
 });
 /*
 $(function(){