@autofleet/settings 2.0.1-beta-context → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.test.js +10 -26
- package/package.json +1 -1
- package/src/index.test.ts +10 -30
- package/src/index.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,11 +13,11 @@ interface Location {
|
|
|
13
13
|
interface Label {
|
|
14
14
|
businessModelId?: string;
|
|
15
15
|
demandSourceId?: string;
|
|
16
|
-
contextId?: string;
|
|
17
16
|
fleetId?: string;
|
|
18
17
|
vendorId?: string;
|
|
19
18
|
time?: string | Date;
|
|
20
19
|
location?: Location;
|
|
20
|
+
contextId?: string;
|
|
21
21
|
}
|
|
22
22
|
type LabelsArray = Label[];
|
|
23
23
|
interface GetSettingOption {
|
package/dist/index.test.js
CHANGED
|
@@ -97,8 +97,16 @@ describe('Settings', () => {
|
|
|
97
97
|
expect(m.isDone()).toBeTruthy();
|
|
98
98
|
expect(value2).toEqual('value1EM');
|
|
99
99
|
}));
|
|
100
|
-
it(
|
|
101
|
-
|
|
100
|
+
it.each([
|
|
101
|
+
{ label: 'businessModelId', labelValue: 'businessModelId' },
|
|
102
|
+
{ label: 'demandSourceId', labelValue: 'demandSourceId' },
|
|
103
|
+
{ label: 'fleetId', labelValue: 'fleetId' },
|
|
104
|
+
{ label: 'vendorId', labelValue: 'vendorId' },
|
|
105
|
+
{ label: 'time', labelValue: new Date() },
|
|
106
|
+
{ label: 'location', labelValue: { lat: 32.07917469952991, lng: 34.777393341064446 } },
|
|
107
|
+
{ label: 'contextId', labelValue: 'contextId' },
|
|
108
|
+
])('Finds with $label', (_a) => __awaiter(void 0, [_a], void 0, function* ({ label, labelValue }) {
|
|
109
|
+
const labels = [{ [label]: labelValue }];
|
|
102
110
|
const m = mockSetting('key1', 'value1', labels);
|
|
103
111
|
const settings = new index_1.default({
|
|
104
112
|
serviceUrl: `http://${serviceUrl}/`,
|
|
@@ -107,30 +115,6 @@ describe('Settings', () => {
|
|
|
107
115
|
expect(value).toEqual('value1');
|
|
108
116
|
expect(m.isDone()).toBeTruthy();
|
|
109
117
|
}));
|
|
110
|
-
it('Finds with time label', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
-
const time = new Date();
|
|
112
|
-
const labels = [{ fleetId: 'uuid', time }];
|
|
113
|
-
const m = mockSetting('key1', 'value1', labels);
|
|
114
|
-
const settings = new index_1.default({
|
|
115
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
116
|
-
});
|
|
117
|
-
const settingLabel = [{ fleetId: 'uuid', time }];
|
|
118
|
-
const value = yield settings.get('key1', 'dv', settingLabel);
|
|
119
|
-
expect(value).toEqual('value1');
|
|
120
|
-
expect(m.isDone()).toBeTruthy();
|
|
121
|
-
}));
|
|
122
|
-
it('Finds with location label', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
123
|
-
const location = { lat: 32.07917469952991, lng: 34.777393341064446 };
|
|
124
|
-
const labels = [{ fleetId: 'uuid', location }];
|
|
125
|
-
const m = mockSetting('key1', 'value1', labels);
|
|
126
|
-
const settings = new index_1.default({
|
|
127
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
128
|
-
});
|
|
129
|
-
const settingLabel = [{ fleetId: 'uuid', location }];
|
|
130
|
-
const value = yield settings.get('key1', 'dv', settingLabel);
|
|
131
|
-
expect(value).toEqual('value1');
|
|
132
|
-
expect(m.isDone()).toBeTruthy();
|
|
133
|
-
}));
|
|
134
118
|
it('Finds with location and time label', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
119
|
const time = new Date();
|
|
136
120
|
const location = { lat: 32.07917469952991, lng: 34.777393341064446 };
|
package/package.json
CHANGED
package/src/index.test.ts
CHANGED
|
@@ -106,8 +106,16 @@ describe('Settings', () => {
|
|
|
106
106
|
expect(value2).toEqual('value1EM');
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
it(
|
|
110
|
-
|
|
109
|
+
it.each([
|
|
110
|
+
{ label: 'businessModelId', labelValue: 'businessModelId' },
|
|
111
|
+
{ label: 'demandSourceId', labelValue: 'demandSourceId' },
|
|
112
|
+
{ label: 'fleetId', labelValue: 'fleetId' },
|
|
113
|
+
{ label: 'vendorId', labelValue: 'vendorId' },
|
|
114
|
+
{ label: 'time', labelValue: new Date() },
|
|
115
|
+
{ label: 'location', labelValue: { lat: 32.07917469952991, lng: 34.777393341064446 } },
|
|
116
|
+
{ label: 'contextId', labelValue: 'contextId' },
|
|
117
|
+
])('Finds with $label', async ({ label, labelValue }) => {
|
|
118
|
+
const labels = [{ [label]: labelValue }];
|
|
111
119
|
const m = mockSetting('key1', 'value1', labels);
|
|
112
120
|
const settings = new Settings({
|
|
113
121
|
serviceUrl: `http://${serviceUrl}/`,
|
|
@@ -118,34 +126,6 @@ describe('Settings', () => {
|
|
|
118
126
|
expect(m.isDone()).toBeTruthy();
|
|
119
127
|
});
|
|
120
128
|
|
|
121
|
-
it('Finds with time label', async () => {
|
|
122
|
-
const time = new Date();
|
|
123
|
-
const labels = [{ fleetId: 'uuid', time }];
|
|
124
|
-
const m = mockSetting('key1', 'value1', labels);
|
|
125
|
-
const settings = new Settings({
|
|
126
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const settingLabel = [{ fleetId: 'uuid', time }];
|
|
130
|
-
const value = await settings.get('key1', 'dv', settingLabel);
|
|
131
|
-
expect(value).toEqual('value1');
|
|
132
|
-
expect(m.isDone()).toBeTruthy();
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('Finds with location label', async () => {
|
|
136
|
-
const location = { lat: 32.07917469952991, lng: 34.777393341064446 };
|
|
137
|
-
const labels = [{ fleetId: 'uuid', location }];
|
|
138
|
-
const m = mockSetting('key1', 'value1', labels);
|
|
139
|
-
const settings = new Settings({
|
|
140
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
const settingLabel = [{ fleetId: 'uuid', location }];
|
|
144
|
-
const value = await settings.get('key1', 'dv', settingLabel);
|
|
145
|
-
expect(value).toEqual('value1');
|
|
146
|
-
expect(m.isDone()).toBeTruthy();
|
|
147
|
-
});
|
|
148
|
-
|
|
149
129
|
it('Finds with location and time label', async () => {
|
|
150
130
|
const time = new Date();
|
|
151
131
|
const location = { lat: 32.07917469952991, lng: 34.777393341064446 };
|
package/src/index.ts
CHANGED
|
@@ -33,11 +33,11 @@ interface Location {
|
|
|
33
33
|
interface Label {
|
|
34
34
|
businessModelId?: string;
|
|
35
35
|
demandSourceId?: string;
|
|
36
|
-
contextId?:string;
|
|
37
36
|
fleetId?: string;
|
|
38
37
|
vendorId?: string;
|
|
39
38
|
time?: string | Date;
|
|
40
39
|
location?: Location;
|
|
40
|
+
contextId?: string;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
type LabelsArray = Label[];
|