@autofleet/settings 2.0.0 → 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 CHANGED
@@ -17,6 +17,7 @@ interface Label {
17
17
  vendorId?: string;
18
18
  time?: string | Date;
19
19
  location?: Location;
20
+ contextId?: string;
20
21
  }
21
22
  type LabelsArray = Label[];
22
23
  interface GetSettingOption {
@@ -97,8 +97,16 @@ describe('Settings', () => {
97
97
  expect(m.isDone()).toBeTruthy();
98
98
  expect(value2).toEqual('value1EM');
99
99
  }));
100
- it('Finds with labels', () => __awaiter(void 0, void 0, void 0, function* () {
101
- const labels = [{ fleetId: 'uuid' }];
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/settings",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.test.ts CHANGED
@@ -106,8 +106,16 @@ describe('Settings', () => {
106
106
  expect(value2).toEqual('value1EM');
107
107
  });
108
108
 
109
- it('Finds with labels', async () => {
110
- const labels = [{ fleetId: 'uuid' }];
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
@@ -37,6 +37,7 @@ interface Label {
37
37
  vendorId?: string;
38
38
  time?: string | Date;
39
39
  location?: Location;
40
+ contextId?: string;
40
41
  }
41
42
 
42
43
  type LabelsArray = Label[];