uranio 1.4.0 → 1.4.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/.uranio/package.json
CHANGED
|
@@ -115,7 +115,8 @@ export class MySQLAtomClient<S extends atom_types.mysql_atom> {
|
|
|
115
115
|
});
|
|
116
116
|
const [rows] = await this.client.exe(query);
|
|
117
117
|
if (Array.isArray(rows) && rows[0]) {
|
|
118
|
-
|
|
118
|
+
const count = (rows[0] as any).count;
|
|
119
|
+
return typeof count === 'string' ? parseInt(count, 10) : (count || 0);
|
|
119
120
|
}
|
|
120
121
|
return 0;
|
|
121
122
|
}
|
|
@@ -115,7 +115,8 @@ export class PostgreSQLAtomClient<S extends atom_types.postgresql_atom> {
|
|
|
115
115
|
});
|
|
116
116
|
const [rows] = await this.client.exe(query);
|
|
117
117
|
if (Array.isArray(rows) && rows[0]) {
|
|
118
|
-
|
|
118
|
+
const count = (rows[0] as any).count;
|
|
119
|
+
return typeof count === 'string' ? parseInt(count, 10) : (count || 0);
|
|
119
120
|
}
|
|
120
121
|
return 0;
|
|
121
122
|
}
|
|
@@ -136,5 +136,25 @@ describe('MySQLAtomClient', () => {
|
|
|
136
136
|
|
|
137
137
|
expect(count).toBe(1000000);
|
|
138
138
|
});
|
|
139
|
+
|
|
140
|
+
it('should convert string count to number', async () => {
|
|
141
|
+
const mockResult = [[{count: '42'}], []];
|
|
142
|
+
(mockClient.exe as jest.Mock).mockResolvedValue(mockResult);
|
|
143
|
+
|
|
144
|
+
const count = await atomClient.countAtoms();
|
|
145
|
+
|
|
146
|
+
expect(count).toBe(42);
|
|
147
|
+
expect(typeof count).toBe('number');
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('should handle string count with large numbers', async () => {
|
|
151
|
+
const mockResult = [[{count: '1000000'}], []];
|
|
152
|
+
(mockClient.exe as jest.Mock).mockResolvedValue(mockResult);
|
|
153
|
+
|
|
154
|
+
const count = await atomClient.countAtoms();
|
|
155
|
+
|
|
156
|
+
expect(count).toBe(1000000);
|
|
157
|
+
expect(typeof count).toBe('number');
|
|
158
|
+
});
|
|
139
159
|
});
|
|
140
160
|
});
|
|
@@ -136,5 +136,25 @@ describe('PostgreSQLAtomClient', () => {
|
|
|
136
136
|
|
|
137
137
|
expect(count).toBe(1000000);
|
|
138
138
|
});
|
|
139
|
+
|
|
140
|
+
it('should convert string count to number', async () => {
|
|
141
|
+
const mockResult = [[{count: '42'}], []];
|
|
142
|
+
(mockClient.exe as jest.Mock).mockResolvedValue(mockResult);
|
|
143
|
+
|
|
144
|
+
const count = await atomClient.countAtoms();
|
|
145
|
+
|
|
146
|
+
expect(count).toBe(42);
|
|
147
|
+
expect(typeof count).toBe('number');
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('should handle string count with large numbers', async () => {
|
|
151
|
+
const mockResult = [[{count: '1000000'}], []];
|
|
152
|
+
(mockClient.exe as jest.Mock).mockResolvedValue(mockResult);
|
|
153
|
+
|
|
154
|
+
const count = await atomClient.countAtoms();
|
|
155
|
+
|
|
156
|
+
expect(count).toBe(1000000);
|
|
157
|
+
expect(typeof count).toBe('number');
|
|
158
|
+
});
|
|
139
159
|
});
|
|
140
160
|
});
|