Skip to content

Commit 6e46b16

Browse files
test: fix tests
1 parent 1b5a765 commit 6e46b16

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: test/tests/unit/adopted-probes.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const defaultConnectedProbe: Probe = {
5959
const selectStub = sinon.stub();
6060
const updateStub = sinon.stub();
6161
const deleteStub = sinon.stub();
62-
const insertStub = sinon.stub();
62+
const rawStub = sinon.stub();
6363
const whereStub = sinon.stub().returns({
6464
update: updateStub,
6565
delete: deleteStub,
@@ -70,8 +70,8 @@ const joinStub = sinon.stub().returns({
7070
const sqlStub = sinon.stub().returns({
7171
join: joinStub,
7272
where: whereStub,
73-
insert: insertStub,
74-
});
73+
}) as sinon.SinonStub<any[], any> & {raw: any};
74+
sqlStub.raw = rawStub;
7575
const fetchSocketsStub = sinon.stub().resolves([]);
7676
let sandbox: sinon.SinonSandbox;
7777

@@ -280,13 +280,13 @@ describe('AdoptedProbes', () => {
280280

281281
await adoptedProbes.syncDashboardData();
282282

283-
expect(insertStub.callCount).to.equal(1);
283+
expect(rawStub.callCount).to.equal(1);
284284

285-
expect(insertStub.args[0]).to.deep.equal([{
285+
expect(rawStub.args[0][1]).to.deep.equal({
286286
recipient: '3cff97ae-4a0a-4f34-9f1a-155e6def0a45',
287287
subject: 'Adopted probe country change',
288-
message: 'Globalping API detected that your adopted probe with ip: 1.1.1.1 is located at "GB". So its country value changed from "IE" to "GB", and previous custom city value "Dublin" is not applied right now.\n\nIf this change is not right please report in [that issue](https://github.com/jsdelivr/globalping/issues/268).',
289-
}]);
288+
message: 'Globalping API detected that your adopted probe with ip: 1.1.1.1 is located at "GB". So its country value changed from "IE" to "GB", and custom city value "Dublin" is not applied right now.\n\nIf this change is not right please report in [that issue](https://github.com/jsdelivr/globalping/issues/268).',
289+
});
290290

291291
expect(whereStub.callCount).to.equal(1);
292292
expect(whereStub.args[0]).to.deep.equal([{ ip: '1.1.1.1' }]);

0 commit comments

Comments
 (0)