blob: 093e17341c144dc96bffad244ec4a78e79f7dfae [file] [log] [blame]
Ittay Stern6f900cc2018-08-29 17:01:32 +03001import {TestBed} from "@angular/core/testing";
2import {ObjectToArrayPipe} from "./objectToArray.pipe";
3
4
5describe('Object To Array Pipe', () => {
6 let pipe: ObjectToArrayPipe;
7
8 beforeAll(done => (async () => {
9 TestBed.configureTestingModule({
10
11 });
12 await TestBed.compileComponents();
13 pipe = new ObjectToArrayPipe();
14
15 })().then(done).catch(done.fail));
16
17
18 test('should flat object to array', () => {
19 let object = {
20 "a" : {
21 "name" : "A"
22 },
23 "b" : {
24 "name" : "B"
25 },
26 "c" : {
27 "name" : "C"
28 }
29 };
30 let result = pipe.transform(object);
31 expect(result[0]).toEqual({"name" : "A"});
32 expect(result[1]).toEqual({"name" : "B"});
33 expect(result[2]).toEqual({"name" : "C"});
34 });
35});