V- Modal AI: Visual Video / Image Search - Flutter Video SDK
Dart android-sdkflutterflutter-appflutter-packageflutter-sdkflutter-videoflutter-video-editingflutter-video-playerflutter-video-sdkflutter-videosflutter-videosdkmobile-videomobile-video-editor-sdkmobile-video-sdkvideo-editingvideo-sdkvideo-searchvideo-search-enginevideo-streaming
import 'dart:convert';
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
final docsRoot = Directory('doc');
final internalDocs = docsRoot.existsSync() && File('docs.py').existsSync();
final requiredDocs = <String>[
'README.md',
'index.html',
'index.json',
'vmodal_sdk_flutter/index.html',
'vmodal_sdk_flutter/VmodalClient-class.html',
'vmodal_sdk_flutter/VmodalClient/VmodalClient.html',
'vmodal_sdk_flutter/VmodalClient/close.html',
'vmodal_sdk_flutter/VModal-class.html',
'vmodal_sdk_flutter/VModal/configure.html',
'vmodal_sdk_flutter/VModal/connectWithBackend.html',
'vmodal_sdk_flutter/BackendConnection-class.html',
'vmodal_sdk_flutter/BackendConnection/session.html',
'vmodal_sdk_flutter/BackendConnection/scope.html',
'vmodal_sdk_flutter/BackendConnection/refresh.html',
'vmodal_sdk_flutter/BackendConnection/close.html',
'vmodal_sdk_flutter/BackendConnectionState.html',
'vmodal_sdk_flutter/ScopedTokenEnvelope-class.html',
'vmodal_sdk_flutter/ScopedTokenEnvelope/ScopedTokenEnvelope.fromJson.html',
'vmodal_sdk_flutter/ScopedGrant-class.html',
'vmodal_sdk_flutter/ScopedGrant/ScopedGrant.fromJson.html',
'vmodal_sdk_flutter/BackendAuthException-class.html',
'vmodal_sdk_flutter/BackendAuthFailure.html',
'vmodal_sdk_flutter/VModalProject-class.html',
'vmodal_sdk_flutter/VModalProject/scope.html',
'vmodal_sdk_flutter/VModalProject/listCollections.html',
'vmodal_sdk_flutter/VModalProject/close.html',
'vmodal_sdk_flutter/VModalScope-class.html',
'vmodal_sdk_flutter/VModalScope/upload.html',
'vmodal_sdk_flutter/VModalScope/search.html',
'vmodal_sdk_flutter/CollectionsResource/listGroups.html',
'vmodal_sdk_flutter/CollectionUploads/videoUpload.html',
'vmodal_sdk_flutter/UploadTask-class.html',
'vmodal_sdk_flutter/UserSessionManager-class.html',
'vmodal_sdk_flutter/UserSession-class.html',
'vmodal_sdk_flutter/UserScope-class.html',
'vmodal_sdk_flutter/SessionContext-class.html',
'vmodal_sdk_flutter/TenantCredentialSource-class.html',
'vmodal_sdk_flutter/SessionStorageLease-class.html',
];
final forbiddenDocs = <String>[
'swagger.yaml',
'swagger-ui',
'openapi:',
'operationid',
'x-flutter-sdk-method',
'class="summary source-code"',
'id="source"',
'routes-class.html',
'routespec',
'routecategory',
'publicgatewayurl',
'publicgatewayurlhash',
'devgatewayurl',
'searchapi-test.v-modal.com',
'/api/v1',
'/api/external/v1',
'/api/v1',
'/api/external/v1',
'/api/v1',
'/api/external/v1',
];
Iterable<File> docsTextFiles() sync* {
const suffixes = <String>{
'.css',
'.html',
'.js',
'.json',
'.md',
'.svg',
'.txt',
'.xml',
};
for (final entity in docsRoot.listSync(recursive: true)) {
if (entity is File &&
suffixes.any((String suffix) => entity.path.endsWith(suffix))) {
yield entity;
}
}
}
void main() {
test('generated SDK reference contains required navigation and pages', () {
if (!internalDocs) return;
stdout.writeln('[docs] checking ${requiredDocs.length} required pages');
expect(docsRoot.existsSync(), isTrue);
for (final path in requiredDocs) {
expect(File('${docsRoot.path}/$path').existsSync(), isTrue, reason: path);
}
expect(File('${docsRoot.path}/index.json').lengthSync(), greaterThan(1000));
});
test('search inventory exposes representative public SDK symbols', () {
if (!internalDocs) return;
final rows =
jsonDecode(File('${docsRoot.path}/index.json').readAsStringSync())
as List<Object?>;
final names = rows
.cast<Map<String, Object?>>()
.map((Map<String, Object?> row) => '${row['qualifiedName']}')
.toSet();
const expected = <String>[
'vmodal_sdk_flutter.VmodalClient',
'vmodal_sdk_flutter.VModal',
'vmodal_sdk_flutter.VModalProject',
'vmodal_sdk_flutter.VModalScope',
'vmodal_sdk_flutter.VModal.configure',
'vmodal_sdk_flutter.VModal.connectWithBackend',
'vmodal_sdk_flutter.BackendConnection',
'vmodal_sdk_flutter.BackendConnection.session',
'vmodal_sdk_flutter.BackendConnection.scope',
'vmodal_sdk_flutter.BackendConnection.refresh',
'vmodal_sdk_flutter.BackendConnection.close',
'vmodal_sdk_flutter.BackendConnectionState',
'vmodal_sdk_flutter.ScopedTokenEnvelope',
'vmodal_sdk_flutter.ScopedTokenEnvelope.ScopedTokenEnvelope.fromJson',
'vmodal_sdk_flutter.ScopedGrant',
'vmodal_sdk_flutter.ScopedGrant.ScopedGrant.fromJson',
'vmodal_sdk_flutter.BackendAuthException',
'vmodal_sdk_flutter.BackendAuthFailure',
'vmodal_sdk_flutter.VModalProject.scope',
'vmodal_sdk_flutter.VModalProject.listCollections',
'vmodal_sdk_flutter.VModalScope.upload',
'vmodal_sdk_flutter.VModalScope.search',
'vmodal_sdk_flutter.SearchesResource.searchVideo',
'vmodal_sdk_flutter.CollectionUploads.videoUpload',
'vmodal_sdk_flutter.UploadTask',
'vmodal_sdk_flutter.SdkException',
'vmodal_sdk_flutter.UserSessionManager',
'vmodal_sdk_flutter.UserSession',
'vmodal_sdk_flutter.UserScope',
'vmodal_sdk_flutter.SessionContext',
'vmodal_sdk_flutter.TenantCredentialSource',
'vmodal_sdk_flutter.SessionStorageLease',
];
stdout.writeln('[docs] index entries=${rows.length}');
for (final name in expected) {
expect(names, contains(name), reason: name);
}
});
test('generated text contains no endpoints or implementation source', () {
if (!internalDocs) return;
var count = 0;
for (final file in docsTextFiles()) {
count++;
final text = utf8.decode(file.readAsBytesSync()).toLowerCase();
for (final value in forbiddenDocs) {
expect(text, isNot(contains(value)), reason: '${file.path}: $value');
}
}
stdout.writeln('[docs] endpoint-free text files checked=$count');
expect(count, greaterThan(100));
});
test('documentation commands use one deterministic Dartdoc pipeline', () {
if (!internalDocs) return;
final generator = File('docs.py').readAsStringSync();
expect(generator, contains('dart, "doc", "--validate-links"'));
expect(generator, contains('os_sanitize_dartdoc(site)'));
expect(generator, contains('os_compare_trees(dest, site)'));
expect(generator, isNot(contains('swagger_operations')));
expect(generator, isNot(contains('routes_contract.json')));
});
test('maintainer docs use SDK reference terminology', () {
if (!internalDocs) return;
for (final path in <String>[
'README_PRIVATE.md',
'docs/release.md',
'docs/sdk_doc.md',
]) {
final text = File(path).readAsStringSync().toLowerCase();
expect(text, isNot(contains('swagger')), reason: path);
expect(text, isNot(contains('openapi')), reason: path);
expect(text, isNot(contains('docs_swagger')), reason: path);
expect(text, contains('doc'), reason: path);
}
});
}