Skip to content

Instantly share code, notes, and snippets.

@JitendraZaa
Created March 10, 2018 19:54
Show Gist options
  • Save JitendraZaa/47ff446258f861f6f8f8896593d471ec to your computer and use it in GitHub Desktop.
Save JitendraZaa/47ff446258f861f6f8f8896593d471ec to your computer and use it in GitHub Desktop.
Jasmine Test Method fo Salesforce Lightning Test Service
describe("Lightning Component Testing Examples", function(){
afterEach(function() {
// Each spec (test) renders its components into the same div,
// so we need to clear that div out at the end of each spec.
$T.clearRenderedTestComponents();
});
describe('c:PersonDemo', function(){
it('Is Datatable Populated', function(done) {
var personListObj = [];
var p = {
firstName : "John",
lastName : "Doe",
age : "28",
eyeColor : "Green"} ;
personListObj.push(p);
var attributes = {
personList:personListObj
};
$T.createComponent("c:PersonDemo", attributes, true)
.then(function(component) {
var totalRecords = component.get("v.personList");
expect(totalRecords.length).toEqual(1);
done();
}).catch(function(e) {
// end this spec as a failure
done.fail(e);
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment