1// Copyright (C) 2018 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15import { 16 createEmptyState, 17 getContainingTrackId, 18 State, 19 TrackKindPriority 20} from './state'; 21 22test('createEmptyState', () => { 23 const state: State = createEmptyState(); 24 expect(state.nextId).toEqual(0); 25}); 26 27test('getContainingTrackId', () => { 28 const state: State = createEmptyState(); 29 state.tracks['a'] = { 30 id: 'a', 31 engineId: 'engine', 32 kind: 'Foo', 33 name: 'a track', 34 trackKindPriority: TrackKindPriority.ORDINARY, 35 config: {}, 36 }; 37 38 state.tracks['b'] = { 39 id: 'b', 40 engineId: 'engine', 41 kind: 'Foo', 42 name: 'b track', 43 trackKindPriority: TrackKindPriority.ORDINARY, 44 config: {}, 45 trackGroup: 'containsB', 46 }; 47 48 expect(getContainingTrackId(state, 'z')).toEqual(null); 49 expect(getContainingTrackId(state, 'a')).toEqual(null); 50 expect(getContainingTrackId(state, 'b')).toEqual('containsB'); 51}); 52