|
| 1 | +// ***************************************************************************** |
| 2 | +// Copyright (C) 2023 EclipseSource and others. |
| 3 | +// |
| 4 | +// This program and the accompanying materials are made available under the |
| 5 | +// terms of the Eclipse Public License v. 2.0 which is available at |
| 6 | +// http://www.eclipse.org/legal/epl-2.0. |
| 7 | +// |
| 8 | +// This Source Code may also be made available under the following Secondary |
| 9 | +// Licenses when the conditions for such availability set forth in the Eclipse |
| 10 | +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 |
| 11 | +// with the GNU Classpath Exception which is available at |
| 12 | +// https://www.gnu.org/software/classpath/license.html. |
| 13 | +// |
| 14 | +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 |
| 15 | +// ***************************************************************************** |
| 16 | + |
| 17 | +import { PreferenceProvider } from './preference-provider'; |
| 18 | +const { expect } = require('chai'); |
| 19 | + |
| 20 | +describe('PreferenceProvider', () => { |
| 21 | + it('should preserve extra source fields on merge', () => { |
| 22 | + const result = PreferenceProvider.merge({ 'configurations': [], 'compounds': [] }, { 'configurations': [] }); |
| 23 | + expect(result).deep.equals({ 'configurations': [], 'compounds': [] }); |
| 24 | + }); |
| 25 | + it('should preserve extra target fields on merge', () => { |
| 26 | + const result = PreferenceProvider.merge({ 'configurations': [] }, { 'configurations': [], 'compounds': [] }); |
| 27 | + expect(result).deep.equals({ 'configurations': [], 'compounds': [] }); |
| 28 | + }); |
| 29 | + it('should merge array values', () => { |
| 30 | + const result = PreferenceProvider.merge( |
| 31 | + { 'configurations': [{ 'name': 'test1', 'request': 'launch' }], 'compounds': [] }, |
| 32 | + { 'configurations': [{ 'name': 'test2' }] } |
| 33 | + ); |
| 34 | + expect(result).deep.equals({ 'configurations': [{ 'name': 'test1', 'request': 'launch' }, { 'name': 'test2' }], 'compounds': [] }); |
| 35 | + }); |
| 36 | +}); |
0 commit comments