test(functions): adds dart test
This commit is contained in:
parent
e64f0f3c5e
commit
d8ec0c59e3
|
@ -535,6 +535,14 @@ class FunctionsCustomServerTest extends Scope
|
|||
'command' => 'deno run --allow-env index.ts',
|
||||
'timeout' => 15,
|
||||
],
|
||||
[
|
||||
'language' => 'Dart',
|
||||
'version' => '2.10.4',
|
||||
'name' => 'dart-2.10.4',
|
||||
'code' => $functions.'/dart.tar.gz',
|
||||
'command' => 'dart run main.dart',
|
||||
'timeout' => 15,
|
||||
],
|
||||
];
|
||||
|
||||
sleep(count($envs) * 25);
|
||||
|
|
26
tests/resources/functions/dart/main.dart
Normal file
26
tests/resources/functions/dart/main.dart
Normal file
|
@ -0,0 +1,26 @@
|
|||
import 'dart:io';
|
||||
import 'package:dart_appwrite/dart_appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
|
||||
client
|
||||
.setEndpoint(process.env.APPWRITE_ENDPOINT) // Your API Endpoint
|
||||
.setProject(process.env.APPWRITE_PROJECT) // Your project ID
|
||||
.setKey(process.env.APPWRITE_SECRET) // Your secret API key
|
||||
;
|
||||
|
||||
Storage storage = Storage(client);
|
||||
|
||||
//Future result = storage.getFile(fileId: '[FILE_ID]');
|
||||
|
||||
print(process.env.APPWRITE_FUNCTION_ID);
|
||||
print(process.env.APPWRITE_FUNCTION_NAME);
|
||||
print(process.env.APPWRITE_FUNCTION_TAG);
|
||||
print(process.env.APPWRITE_FUNCTION_TRIGGER);
|
||||
print(process.env.APPWRITE_FUNCTION_ENV_NAME);
|
||||
print(process.env.APPWRITE_FUNCTION_ENV_VERSION);
|
||||
// print(result['$id']);
|
||||
print(process.env.APPWRITE_FUNCTION_EVENT);
|
||||
print(process.env.APPWRITE_FUNCTION_EVENT_PAYLOAD);
|
||||
}
|
7
tests/resources/functions/dart/pubspec.yaml
Normal file
7
tests/resources/functions/dart/pubspec.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
name: appwrite_cloud_function_demo
|
||||
version: 0.1.0
|
||||
description: Demo cloud function script.
|
||||
environment:
|
||||
sdk: '>=2.10.0 <3.0.0'
|
||||
dependencies:
|
||||
dart_appwrite: ^0.1.0
|
12
tests/resources/functions/package-dart.sh
Normal file
12
tests/resources/functions/package-dart.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
|
||||
echo 'Dart Packaging...'
|
||||
|
||||
cp -r $(pwd)/tests/resources/functions/dart $(pwd)/tests/resources/functions/packages/dart
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/dart:/app -w /app appwrite/env-deno-dart-2.10.4:1.0.0 dart pub get
|
||||
|
||||
docker run --rm -v $(pwd)/tests/resources/functions/packages/dart:/app -w /app appwrite/env-deno-dart-2.10.4:1.0.0 tar -zcvf code.tar.gz .
|
||||
|
||||
mv $(pwd)/tests/resources/functions/packages/dart/code.tar.gz $(pwd)/tests/resources/functions/dart.tar.gz
|
||||
|
||||
rm -r $(pwd)/tests/resources/functions/packages/dart
|
Loading…
Reference in a new issue