* Copyright (c) 2026 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* @file Provides the capability of integrating advertising services with vendors
* @kit AdsKit
*/
* Test result structure
*/
export interface SystemApiTestResult {
readonly testId: string;
readonly passed: boolean;
readonly actual: string;
readonly error?: string;
readonly executionTime?: number;
}
* Categories of test cases
*/
export type TestCategory = "class-definition" | "interface-definition" | "function-definition" | "type-definition" | "enum-definition" | "decorator-definition" | "generic-definition" | "module-declaration" | "namespace-declaration" | "variable-declaration" | "string-literal" | "edge-case" | "mixed-content";
* Test configuration options
*/
export interface TestConfig {
readonly normalizeLineEndings: boolean;
readonly trimWhitespace: boolean;
readonly preserveEmptyLines: boolean;
readonly timeout: number;
readonly verbose: boolean;
}
* Function signature for comment removal
*/
export type CommentRemovalFunction = (code: string) => string;
* Test runner interface
*/
export interface TestRunner {
runAllTests(): readonly SystemApiTestResult[];
runTest(testId: string): SystemApiTestResult | undefined;
runTestsByCategory(category: TestCategory): readonly SystemApiTestResult[];
getTestCase(testId: string): SystemApiTestCase | undefined;
getAllTestCases(): readonly SystemApiTestCase[];
}
* Error types for test failures
*/
export interface TestError {
readonly code: TestErrorCode;
readonly message: string;
readonly testId?: string;
readonly lineNumber?: number;
}
* Error codes for test failures
*/
export type TestErrorCode = "REMOVAL_FAILED" | "INCORRECT_REMOVAL" | "STRING_PRESERVATION_FAILED" | "WHITESPACE_MISMATCH" | "TIMEOUT" | "INVALID_INPUT" | "UNEXPECTED_ERROR";
* Test suite metadata
*/
export interface TestSuiteMetadata {
readonly name: "SystemAPI Comment Removal Test Suite";
readonly version: "1.0.0";
readonly totalTests: number;
readonly categories: readonly TestCategory[];
readonly lastUpdated: string;
}
* All test cases organized by category
*/
export const TEST_CASES_BY_CATEGORY: {
readonly [K in TestCategory]: readonly SystemApiTestCase[];
};
* All test cases as a flat array
*/
export const ALL_TEST_CASES: readonly SystemApiTestCase[];
* Test cases that should pass (both tags present)
*/
export const SHOULD_PASS_CASES: readonly SystemApiTestCase[];
* Test cases that should be preserved (only one tag)
*/
export const SHOULD_PRESERVE_CASES: readonly SystemApiTestCase[];
* Test cases for string literals (should never be removed)
*/
export const STRING_LITERAL_CASES: readonly SystemApiTestCase[];
* Test cases for edge scenarios
*/
export const EDGE_CASES: readonly SystemApiTestCase[];
* Function signature for validating test cases
*/
export type TestCaseValidator = (testCase: SystemApiTestCase) => boolean;
* Function signature for comparing test results
*/
export type ResultComparator = (actual: string, expected: string, config?: TestConfig) => boolean;
* Function signature for reporting test results
*/
export type ResultReporter = (results: readonly SystemApiTestResult[]) => void;
* Default test configuration
*/
export const DEFAULT_TEST_CONFIG: TestConfig;
* Test suite metadata
*/
export const SUITE_METADATA: TestSuiteMetadata;
* Version of the test suite
*/
export const VERSION: "1.0.0";
* Minimum supported TypeScript version
*/
export const MIN_TS_VERSION: "4.0.0";
* Maximum supported TypeScript version
*/
export const MAX_TS_VERSION: "5.4.0";
* Custom assertion result
*/
export interface AssertionResult {
readonly passed: boolean;
readonly message: string;
readonly expected?: unknown;
readonly actual?: unknown;
}
* Assertion function type
*/
export type Assertion = (condition: boolean, message: string) => AssertionResult;
* Equality assertion type
*/
export type EqualityAssertion = <T>(actual: T, expected: T, message: string) => AssertionResult;
* String assertion type
*/
export type StringAssertion = (actual: string, expected: string, message: string) => AssertionResult;