import { expect } from 'chai';
import { Page, View } from '../../../types';
import * as faker from 'faker';

describe('Vertex', () => {
    it('deepPick', () => {
        const page = new Page({
            rootView: new View({
                children: [new View(), new View()],
            }),
        });
        const result = page.toJSON();
        result.id = faker.random.uuid();
        result.rootView.id = faker.random.uuid();
        result.rootView.children[0] = faker.random.uuid();
        result.rootView.children[1] = faker.random.uuid();

        page.deepPick(result, ['id']);

        expect(page.id).to.equal(result.id);
        expect(page.rootView.id).to.equal(result.rootView.id);
        expect(page.rootView.children[0].id).to.equal(result.rootView.children[0].id);
        expect(page.rootView.children[1].id).to.equal(result.rootView.children[1].id);
    });
});
