December 2017
Beginner
372 pages
10h 32m
English
To start off, before we write any test case, the first step is to import the dependencies for the test case. Every test case will have the dependencies on its respective component/pipe/services and any model data. In our case, that would be the custom pipe class and the task object. The following is the code for the import:
import { CustomSort} from './custom-sort.pipe';import { Task } from '../model/task';
Next up is the logic for the test case. The following is the code for both of our test cases; we will go through each step in detail:
describe('Custom Sort pipe', () => { let pipe:CustomSort; let tasks: Task[]; beforeEach(() => { pipe = new CustomSort(); tasks = [{title:"Basic",id:0,subtask:[],taskheaderId:"1"
Read now
Unlock full access