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