Skip to content

Commit c8d3fdd

Browse files
fix(dart): version test (generated)
algolia/api-clients-automation#4387 Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
1 parent 0b92e0e commit c8d3fdd

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: sleep 300
3939

4040
publish_clients:
41-
needs:
41+
needs:
4242
- check
4343
- wait_for_core
4444
strategy:
@@ -47,6 +47,7 @@ jobs:
4747
- packages/client_search
4848
- packages/client_insights
4949
- packages/client_recommend
50+
- packages/client_composition
5051
permissions:
5152
id-token: write
5253
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import 'package:algolia_client_composition/algolia_client_composition.dart';
2+
3+
void main() async {
4+
// Creating an instance of the Composition client with the provided App ID and API key.
5+
final composition = CompositionClient(
6+
appId: 'latency',
7+
apiKey: '6be0576ff61c053d5f9a3225e2a90f76',
8+
);
9+
10+
await composition.search(
11+
compositionID: "foo",
12+
requestBody: RequestBody(
13+
params: Params(
14+
query: "batman",
15+
),
16+
),
17+
);
18+
19+
// Close the client and dispose of all underlying resources.
20+
composition.dispose();
21+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import 'dart:io';
2+
3+
import 'package:algolia_client_composition/src/version.dart';
4+
import 'package:test/test.dart';
5+
6+
void main() {
7+
if (Directory.current.path.endsWith('/test')) {
8+
Directory.current = Directory.current.parent;
9+
}
10+
test('package version matches pubspec', () {
11+
final pubspecPath = '${Directory.current.path}/pubspec.yaml';
12+
final pubspec = File(pubspecPath).readAsStringSync();
13+
final regex = RegExp('version:s*(.*)');
14+
final match = regex.firstMatch(pubspec);
15+
expect(match, isNotNull);
16+
expect(packageVersion, match?.group(1)?.trim());
17+
});
18+
}

0 commit comments

Comments
 (0)