You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
49 lines
1.1 KiB
describe('debounced test', function(){
|
|
|
|
function displayPerson(p){
|
|
|
|
var p1 = p[0];
|
|
var p2 = p[1];
|
|
return p1.name + ',' + p1.dob + '||' + p2.name + ',' + p2.dob;
|
|
//return '--Person name-- - ' + p.name + ',' + p.dob;
|
|
}
|
|
|
|
beforeEach(function(){
|
|
//jasmine.clock().install();
|
|
jasmine.addCustomObjectFormatter(displayPerson);
|
|
});
|
|
|
|
afterEach(function(){
|
|
//jasmine.clock().uninstall();
|
|
});
|
|
/*
|
|
it('should call the method only after the 500ms debounce', function(){
|
|
function debouncedMethod() {
|
|
// do something async;
|
|
}
|
|
|
|
function evaluateResults() {
|
|
// check results of async function
|
|
}
|
|
debouncedMethod();
|
|
|
|
jasmine.clock().tick(501); //increment clock 501 ms.
|
|
|
|
evaluateResults();
|
|
|
|
//assertions follow
|
|
});
|
|
*/
|
|
it('compares some lists', function() {
|
|
const expectedListOfPersons = [
|
|
{name: 'Tom', age:20, dob: '20/10/2000'},
|
|
{name: 'John', age:30, dob: '20/10/1990'}
|
|
];
|
|
const actualListOfPersons = [
|
|
{name: 'Thomas', age:20, dob: '20/10/2000'},
|
|
{name: 'Johnny', age:30, dob: '20/10/1990'}
|
|
];
|
|
|
|
expect(actualListOfPersons).toEqual(expectedListOfPersons);
|
|
});
|
|
});
|