• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 {createEmptyState} from './empty_state';
16import {getContainingTrackId, State, TrackKindPriority} from './state';
17
18test('createEmptyState', () => {
19  const state: State = createEmptyState();
20  expect(state.nextId).toEqual(0);
21});
22
23test('getContainingTrackId', () => {
24  const state: State = createEmptyState();
25  state.tracks['a'] = {
26    id: 'a',
27    engineId: 'engine',
28    kind: 'Foo',
29    name: 'a track',
30    trackKindPriority: TrackKindPriority.ORDINARY,
31    config: {},
32  };
33
34  state.tracks['b'] = {
35    id: 'b',
36    engineId: 'engine',
37    kind: 'Foo',
38    name: 'b track',
39    trackKindPriority: TrackKindPriority.ORDINARY,
40    config: {},
41    trackGroup: 'containsB',
42  };
43
44  expect(getContainingTrackId(state, 'z')).toEqual(null);
45  expect(getContainingTrackId(state, 'a')).toEqual(null);
46  expect(getContainingTrackId(state, 'b')).toEqual('containsB');
47});
48