Skip to content

Instantly share code, notes, and snippets.

@night-fury-rider
Created May 31, 2020 04:00
Show Gist options
  • Save night-fury-rider/80f379619a9a79932eadc73bebed91a7 to your computer and use it in GitHub Desktop.
Save night-fury-rider/80f379619a9a79932eadc73bebed91a7 to your computer and use it in GitHub Desktop.
Unit testing Angular Application using Jasmine - Util Service
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class UvUtilService {
constructor() { }
/**
* @description Function to know passed array are equal or not
* @param arr1 - Array 1
* @param arr2 - Array 2
* @returns true if arrays are equal otherwise return false.
* Note: This method is not recommended if array is large
*/
areArraysEqual(arr1, arr2) {
return JSON.stringify(arr1) === JSON.stringify(arr2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment