UNPKG

@yolkai/nx-workspace

Version:

Extensible Dev Tools for Monorepos

35 lines (34 loc) 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const print_affected_1 = require("./print-affected"); describe('print-affected', () => { describe('selectPrintAffected', () => { const res = { projects: ['one', 'two'], tasks: [ { target: { project: 'one' } }, { target: { project: 'two' } } ] }; it('should return the result if select is empty', () => { expect(print_affected_1.selectPrintAffected(res, null)).toEqual(res); }); it('should select an array if without nesting', () => { expect(print_affected_1.selectPrintAffected(res, 'projects')).toEqual('one, two'); }); it('should throw when invalid key', () => { expect(() => print_affected_1.selectPrintAffected(res, 'projects.invalid')).toThrowError(`Cannot select 'projects.invalid' in the results of print-affected.`); }); it('should select an array if with nesting', () => { expect(print_affected_1.selectPrintAffected(res, 'tasks.target.project')).toEqual('one, two'); }); }); });