Skip to content

Commit 2408e37

Browse files
committed
fix tests and update project
1 parent e0e2a54 commit 2408e37

File tree

5 files changed

+47
-2
lines changed

5 files changed

+47
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.dart_tool/
33
.packages
44
.flutter-plugins
5+
.idea/
56

67
# Conventional directory for build outputs.
78
build/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In your flutter project add the dependency:
1515
``` dart
1616
dependencies:
1717
...
18-
shopify: ^1.0.0
18+
woosignal_shopify: ^1.0.0
1919
```
2020

2121
### Usage example #

dart_test.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tags:
2+
products:
3+
get-products:

lib/networking/api_provider.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ class ApiProvider {
5757
"api_version": "$_version/v1",
5858
"sdk_name": "woosignal-shopify"
5959
};
60+
} else if (Platform.environment.containsKey('FLUTTER_TEST')) {
61+
_deviceMeta = {
62+
"model": 'X Model',
63+
"brand": 'X Brand',
64+
"manufacturer": "X Manufacturer",
65+
"version": 'X Version',
66+
"uuid": '1234567890',
67+
"platform_type": "testing",
68+
"api_version": "$_version/v1",
69+
"sdk_name": "woosignal-shopify"
70+
};
6071
}
6172
}
6273

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1-
void main() {}
1+
import 'package:flutter/material.dart';
2+
import 'package:shared_preferences/shared_preferences.dart';
3+
import 'package:test/test.dart';
4+
import 'package:woosignal_shopify/models/response/products_response.dart';
5+
import 'package:woosignal_shopify/woosignal_shopify.dart';
6+
7+
void main() {
8+
WidgetsFlutterBinding.ensureInitialized();
9+
SharedPreferences.setMockInitialValues({});
10+
11+
setUp(() async {
12+
await WooSignal.instance.init(
13+
appKey: "app_affb6434339b34443a297c2e40a3edab7102137e6d67de9abfe612b749bd",
14+
debugMode: false,
15+
);
16+
});
17+
18+
group('Testing Shopify Products', () {
19+
20+
test('get products', () async {
21+
22+
ProductsResponse? productsResponse = await WooSignal.instance.getProducts();
23+
24+
expect(productsResponse is ProductsResponse, true);
25+
26+
expect(productsResponse?.products!.isNotEmpty, true);
27+
28+
}, tags: ['get-products']);
29+
30+
}, tags: ['products']);
31+
}

0 commit comments

Comments
 (0)