Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

472
Views
How to Unit Test the SortingDataAccessor of DataSource MatTableDataSource

Am not able to Cover the following lines of code?

 this.dataSource.sortingDataAccessor = (item, property) => {
                    switch (property) {
                        case 'status': return item.status;
                        case 'description': return item.description;
                        default: return item[property];
                    }
                };
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Hi,

You can call the function itself. Example:

const sortable = this.dataSource.sortingDataAccessor(row, columnName); //a single row and the column you want to sort
expect(sortable).toBe(row.columnName);
about 4 years ago · Aditya Narayan Gantayat Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!