Created
May 17, 2011 23:02
-
-
Save hltbra/977613 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("CompletaPraMim", function() { | |
var NAMES_JSON = 'http://localhost:4567/names.json'; | |
var result; | |
var completer = new CompletaPraMim(NAMES_JSON, function(values) { | |
result = values; | |
}); | |
function checkIf(options) { | |
runs(function() { | |
completer.tell(options.telling); | |
}); | |
waits(600); | |
runs(function() { | |
expect(result).toEqual(options.outputs); | |
}); | |
} | |
beforeEach(function() { | |
result = []; | |
}); | |
it("should returns empty list when JSON is empty", function() { | |
checkIf({telling: 'abc', | |
outputs: []}); | |
}); | |
it("should return elements whose starting text matches", function() { | |
var paul = ['value1', 'Paul']; | |
checkIf({telling: 'P', | |
outputs: [paul]}); | |
}); | |
it("should be able to return multilpes elements", function() { | |
var paul = ['value2', 'Beatle1: Paul']; | |
var john = ['value3', 'Beatle2: John']; | |
checkIf({telling: 'Beatle', | |
outputs: [paul, john]}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment