|
| 1 | +// Copyright (c) .NET Foundation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | + |
| 4 | +import 'mocha'; |
| 5 | +import { expect } from 'chai'; |
| 6 | +import { capabilities, enableHttpStream, setup } from '../src/setup'; |
| 7 | + |
| 8 | +describe('setup', () => { |
| 9 | + it('enableHttpStream', () => { |
| 10 | + // default |
| 11 | + expect(enableHttpStream).to.equal(false); |
| 12 | + |
| 13 | + // set to true |
| 14 | + setup({ enableHttpStream: true }); |
| 15 | + expect(enableHttpStream).to.equal(true); |
| 16 | + |
| 17 | + // don't change if not explicitly set |
| 18 | + setup({}); |
| 19 | + expect(enableHttpStream).to.equal(true); |
| 20 | + setup({ capabilities: {} }); |
| 21 | + expect(enableHttpStream).to.equal(true); |
| 22 | + |
| 23 | + // set to true |
| 24 | + setup({ enableHttpStream: false }); |
| 25 | + expect(enableHttpStream).to.equal(false); |
| 26 | + }); |
| 27 | + |
| 28 | + it('capabilities', () => { |
| 29 | + // default |
| 30 | + expect(capabilities).to.deep.equal({}); |
| 31 | + |
| 32 | + // various setting & merging without replacing |
| 33 | + setup({ capabilities: { a: '1' } }); |
| 34 | + expect(capabilities).to.deep.equal({ a: '1' }); |
| 35 | + setup({}); |
| 36 | + expect(capabilities).to.deep.equal({ a: '1' }); |
| 37 | + setup({ capabilities: { b: '2' } }); |
| 38 | + expect(capabilities).to.deep.equal({ a: '1', b: '2' }); |
| 39 | + setup({ capabilities: { a: '3' } }); |
| 40 | + expect(capabilities).to.deep.equal({ a: '3', b: '2' }); |
| 41 | + |
| 42 | + // boolean converted to string |
| 43 | + setup({ capabilities: { c: true } }); |
| 44 | + expect(capabilities).to.deep.equal({ a: '3', b: '2', c: 'true' }); |
| 45 | + }); |
| 46 | +}); |
0 commit comments