• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright 2024 Google LLC
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17export interface MotionGolden {
18  actualUrl: string;
19  expectedUrl: string;
20  goldenRepoPath: string;
21  id: string;
22  label: string;
23  result: 'PASSED' | 'FAILED' | 'MISSING_REFERENCE';
24  testClassName: string;
25  testMethodName: string;
26  testTime: string;
27  updated: boolean;
28  videoUrl: string | undefined;
29}
30
31export interface MotionGoldenData {
32  frame_ids: Array<string | number>;
33  features: MotionGoldenFeature[];
34}
35
36export interface MotionGoldenFeature {
37  name: string;
38  type: string;
39  data_points: Array<DataPoint>;
40}
41
42type DataPointTypes =
43  | string
44  | number
45  | boolean
46  | null
47  | DataPointArray
48  | DataPointObject;
49export interface DataPointObject {
50  [member: string]: DataPointTypes;
51}
52export interface DataPointArray extends Array<DataPointTypes> {}
53export interface NotFound {
54  type: 'not_found';
55}
56export type DataPoint = DataPointTypes | NotFound;
57
58export function isNotFound(dataPoint: DataPoint) {
59  return (
60    dataPoint instanceof Object &&
61    'type' in dataPoint &&
62    dataPoint.type === 'not_found'
63  );
64}
65