Skip to content

fix(dart): version test #4387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: sleep 300

publish_clients:
needs:
needs:
- check
- wait_for_core
strategy:
Expand All @@ -47,6 +47,7 @@ jobs:
- packages/client_search
- packages/client_insights
- packages/client_recommend
- packages/client_composition
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:algolia_client_composition/algolia_client_composition.dart';

void main() async {
// Creating an instance of the Composition client with the provided App ID and API key.
final composition = CompositionClient(
appId: 'latency',
apiKey: '6be0576ff61c053d5f9a3225e2a90f76',
);

await composition.search(
compositionID: "foo",
requestBody: RequestBody(
params: Params(
query: "batman",
),
),
);

// Close the client and dispose of all underlying resources.
composition.dispose();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'dart:io';

import 'package:algolia_client_composition/src/version.dart';
import 'package:test/test.dart';

void main() {
if (Directory.current.path.endsWith('/test')) {
Directory.current = Directory.current.parent;
}
test('package version matches pubspec', () {
final pubspecPath = '${Directory.current.path}/pubspec.yaml';
final pubspec = File(pubspecPath).readAsStringSync();
final regex = RegExp('version:s*(.*)');
final match = regex.firstMatch(pubspec);
expect(match, isNotNull);
expect(packageVersion, match?.group(1)?.trim());
});
}