Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

test

Manav Rathi02aed696fb05
diff --git a/mobile/apps/photos/integration_test/ente_photos_rust_test.dart b/mobile/apps/photos/integration_test/ente_photos_rust_test.dart
new file mode 100644
index 0000000000..99bf0623cf
--- /dev/null
+++ b/mobile/apps/photos/integration_test/ente_photos_rust_test.dart
@@ -0,0 +1,16 @@
+import 'package:flutter_test/flutter_test.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:photos/src/rust/api/init.dart';
+import 'package:photos/src/rust/frb_generated.dart';
+
+void main() {
+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+
+ setUp(() async {
+ await RustLib.init();
+ });
+
+ test('Can call rust function', () {
+ expect(greet(name: 'Test'), equals('Hello, Test!'));
+ });
+}
diff --git a/mobile/apps/photos/integration_test/rust_bridge_test.dart b/mobile/apps/photos/integration_test/ente_rust_test.dart
similarity index 77%
rename from mobile/apps/photos/integration_test/rust_bridge_test.dart
rename to mobile/apps/photos/integration_test/ente_rust_test.dart
index ea1ce23ef9..17e70bef30 100644
--- a/mobile/apps/photos/integration_test/rust_bridge_test.dart
+++ b/mobile/apps/photos/integration_test/ente_rust_test.dart
@@ -1,13 +1,12 @@
+import 'package:ente_rust/ente_rust.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
-import 'package:photos/src/rust/api/urls.dart';
-import 'package:photos/src/rust/frb_generated.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
setUp(() async {
- await RustLib.init();
+ await EnteRust.init();
});
test('file_download_url integration smoke test', () {
diff --git a/mobile/apps/photos/integration_test/simple_test.dart b/mobile/apps/photos/integration_test/simple_test.dart
deleted file mode 100644
index d55a2badac..0000000000
--- a/mobile/apps/photos/integration_test/simple_test.dart
+++ /dev/null
@@ -1,13 +0,0 @@
-import 'package:flutter_test/flutter_test.dart';
-import 'package:integration_test/integration_test.dart';
-import "package:photos/src/rust/api/simple.dart";
-import 'package:photos/src/rust/frb_generated.dart';
-
-void main() {
- IntegrationTestWidgetsFlutterBinding.ensureInitialized();
- setUpAll(() async => await RustLib.init());
- testWidgets('Can call rust function', (WidgetTester tester) async {
- final testString = greet(name: "Tom");
- expect(testString.contains('Tom'), true);
- });
-}
diff --git a/mobile/apps/photos/pubspec.lock b/mobile/apps/photos/pubspec.lock
index 8deef51a0d..47196f6804 100644
--- a/mobile/apps/photos/pubspec.lock
+++ b/mobile/apps/photos/pubspec.lock
@@ -623,6 +623,13 @@ packages:
relative: true
source: path
version: "0.0.1"
+ ente_rust:
+ dependency: "direct main"
+ description:
+ path: "../../packages/rust"
+ relative: true
+ source: path
+ version: "0.0.1"
equatable:
dependency: "direct main"
description:
diff --git a/mobile/apps/photos/rust/Cargo.lock b/mobile/apps/photos/rust/Cargo.lock
index cabf13488d..f439d8c785 100644
--- a/mobile/apps/photos/rust/Cargo.lock
+++ b/mobile/apps/photos/rust/Cargo.lock
@@ -309,10 +309,6 @@ dependencies = [
"crypto-common",
]
-[[package]]
-name = "ente-core"
-version = "0.0.1"
-
[[package]]
name = "env_filter"
version = "0.1.3"
@@ -712,9 +708,8 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "rust_lib_photos"
-version = "0.1.0"
+version = "0.0.1"
dependencies = [
- "ente-core",
"flutter_rust_bridge",
"usearch",
]
diff --git a/mobile/apps/photos/rust/src/api/simple.rs b/mobile/apps/photos/rust/src/api/init.rs
similarity index 58%
rename from mobile/apps/photos/rust/src/api/simple.rs
rename to mobile/apps/photos/rust/src/api/init.rs
index 4360c82ae0..1ef5327475 100644
--- a/mobile/apps/photos/rust/src/api/simple.rs
+++ b/mobile/apps/photos/rust/src/api/init.rs
@@ -1,10 +1,9 @@
-#[flutter_rust_bridge::frb(sync)] // Synchronous mode for simplicity of the demo
-pub fn greet(name: String) -> String {
- format!("Hello, {name}!")
-}
-
#[flutter_rust_bridge::frb(init)]
pub fn init_app() {
- // Default utilities - feel free to customize
flutter_rust_bridge::setup_default_user_utils();
}
+
+#[flutter_rust_bridge::frb(sync)]
+pub fn greet(name: String) -> String {
+ format!("Hello, {name}!")
+}
diff --git a/mobile/apps/photos/rust/src/api/mod.rs b/mobile/apps/photos/rust/src/api/mod.rs
index 48c07eb9a0..0f2ad1bb99 100644
--- a/mobile/apps/photos/rust/src/api/mod.rs
+++ b/mobile/apps/photos/rust/src/api/mod.rs
@@ -1,2 +1,2 @@
-pub mod simple;
+pub mod init;
pub mod usearch_api;
diff --git a/mobile/packages/rust/rust/src/api/init.rs b/mobile/packages/rust/rust/src/api/init.rs
index 5f23c1a9b8..1606ea581d 100644
--- a/mobile/packages/rust/rust/src/api/init.rs
+++ b/mobile/packages/rust/rust/src/api/init.rs
@@ -1,5 +1,4 @@
#[flutter_rust_bridge::frb(init)]
pub fn init_app() {
- // Default utilities - feel free to customize
flutter_rust_bridge::setup_default_user_utils();
}
diff --git a/mobile/packages/rust/test_driver/integration_test.dart b/mobile/packages/rust/test_driver/integration_test.dart
deleted file mode 100644
index b38629cca9..0000000000
--- a/mobile/packages/rust/test_driver/integration_test.dart
+++ /dev/null
@@ -1,3 +0,0 @@
-import 'package:integration_test/integration_test_driver.dart';
-
-Future<void> main() => integrationDriver();
diff --git a/rust/README.md b/rust/README.md
index f5d744a423..07bccbad95 100644
--- a/rust/README.md
+++ b/rust/README.md
@@ -154,7 +154,6 @@ yarn build:wasm # builds the WASM package
```sh
cargo install flutter_rust_bridge_codegen
flutter_rust_bridge_codegen generate
-flutter test
```
`flutter_rust_bridge_codegen generate` needs to be run either manually (or in watch mode, `flutter_rust_bridge_codegen generate --watch`) whenever the Rust source changes to get the bindings to update.
@@ -206,7 +205,6 @@ wasm = ["getrandom/js"]
## Tests
- **ente-core:** Standard `cargo test` - comprehensive unit tests
-- **ente-rust:** Minimal FRB smoke test in Dart to catch binding drift
-- **ente-photos-rust:** Integration tests for app-specific functionality
+- **ente-photos-rust:** Minimal FRB smoke test in Dart to catch binding drift
- **ente-wasm:** Vitest tests in web package
- **Golden fixtures:** Share test vectors across native/FRB/WASM for crypto parity