File tree Expand file tree Collapse file tree 2 files changed +23
-11
lines changed
src/functions/datastore-integration-orderdesk
test/functions/datastore-integration-orderdesk Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,27 @@ class DataStore extends DataStoreBase {
27
27
this . domain = "app.orderdesk.me" ;
28
28
this . api = "api/v2/" ;
29
29
this . setCredentials ( ) ;
30
+ this . setDefaultConfig ( ) ;
31
+ }
32
+
33
+ /**
34
+ * @inheritdoc
35
+ */
36
+ setCredentials ( ) {
37
+ const credentials = this . parseConfigCredentials ( config ) ;
38
+ if ( ! credentials . key || ! credentials . id ) {
39
+ throw new Error ( "Environment variables for OrderDesk store id and/or API key are missing." ) ;
40
+ }
41
+ this . credentials = credentials ;
42
+ }
43
+
44
+ /**
45
+ * If no value is set for the skip update inventory option, skip all inventories.
46
+ */
47
+ setDefaultConfig ( ) {
48
+ if ( ! config . datastore . skipUpdate . inventory ) {
49
+ this . skipUpdate . inventory . all = true ;
50
+ }
30
51
}
31
52
32
53
/**:
@@ -42,17 +63,6 @@ class DataStore extends DataStoreBase {
42
63
}
43
64
}
44
65
45
- /**
46
- * @inheritdoc
47
- */
48
- setCredentials ( ) {
49
- const credentials = this . parseConfigCredentials ( config ) ;
50
- if ( ! credentials . key || ! credentials . id ) {
51
- throw new Error ( "Environment variables for OrderDesk store id and/or API key are missing." ) ;
52
- }
53
- this . credentials = credentials ;
54
- }
55
-
56
66
parseConfigCredentials ( config ) {
57
67
const rawCredentials = config . datastore . credentials ;
58
68
let matched ;
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ describe("OrderDesk Datastore", function() {
83
83
describe ( "Update OrderDesk items" , function ( ) {
84
84
85
85
describe ( "Does not update to invalid states" , function ( ) {
86
+ config . datastore . skipUpdate . inventory = '__NONE__' ;
86
87
const odClient = new DataStore ( ) ;
87
88
const fullItem = orderDeskFullItem ( ) ;
88
89
for ( let k of Object . keys ( fullItem ) ) {
@@ -95,6 +96,7 @@ describe("OrderDesk Datastore", function() {
95
96
} ) ;
96
97
97
98
describe ( "Sends an appropriate PUT request" , async function ( ) {
99
+ config . datastore . skipUpdate . inventory = '__NONE__' ;
98
100
const odClient = new DataStore ( ) ;
99
101
const fullItem = orderDeskFullItem ( ) ;
100
102
const prevfetch = DataStore . __get__ ( 'fetch' ) ;
You can’t perform that action at this time.
0 commit comments