Skip to content

Instantly share code, notes, and snippets.

@joachimhs
Created March 30, 2013 19:54
Show Gist options
  • Save joachimhs/5278104 to your computer and use it in GitHub Desktop.
Save joachimhs/5278104 to your computer and use it in GitHub Desktop.
Simple QUnit test
var appController;
var inputDate = new Date(2013,2,27,11,15,00);
module("EurekaJ.AppController", {
setup: function() {
Ember.run(function() {
appController = EurekaJ.__container__.lookup("controller:application");
});
},
teardown: function() {
}
});
test("Verify appController", function() {
EurekaJ.reset();
ok (appController, "Expecting non-null appController");
});
test("Testing the default dateFormat", function() {
EurekaJ.reset();
ok ("27 March 2013 11:15" === appController.generateChartString(inputDate), "Default Chart String Generation OK");
});
test("Testing custom dateFormat", function() {
EurekaJ.reset();
appController.set('dateFormat', 'dd.mm.yyyy');
ok ("27.03.2013" === appController.generateChartString(inputDate), "Custom Chart String Generation OK");
});
test("Testing null dateFormat", function() {
EurekaJ.reset();
appController.set('dateFormat', null);
ok ("27.03.13" === appController.generateChartString(inputDate), "Null Chart String Generation OK");
});
test("Testing null date", function() {
EurekaJ.reset();
ok ("" === appController.generateChartString(null), "Null Date OK");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment