Skip to content

Commit

Permalink
ignore async event in tests instead
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardoventurini committed Nov 29, 2023
1 parent f2faf8e commit bc45bcf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ versions.json
.idea
.eslintcache
.envrc
/packages/*
1 change: 1 addition & 0 deletions lib/hijack/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function wrapFibers () {
wrapped = true;

let originalYield = Fibers.yield;

Fibers.yield = function () {
let kadiraInfo = Kadira._getInfo();
if (kadiraInfo) {
Expand Down
7 changes: 4 additions & 3 deletions tests/_helpers/helpers.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { DDP } from 'meteor/ddp';
const Future = Npm.require('fibers/future');
import { MethodStore, TestData } from './globals';

const Future = Npm.require('fibers/future');

export const GetMeteorClient = function (_url) {
const url = _url || Meteor.absoluteUrl();
return DDP.connect(url, {retry: false});
Expand Down Expand Up @@ -31,7 +32,7 @@ export const EnableTrackingMethods = function () {
// };
};

export const GetLastMethodEvents = function (_indices) {
export const GetLastMethodEvents = function (_indices, ignore = []) {
if (MethodStore.length < 1) {
return [];
}
Expand All @@ -43,7 +44,7 @@ export const GetLastMethodEvents = function (_indices) {
return events;

function isNotCompute (event) {
return event[0] !== 'compute';
return event[0] !== 'compute' && !ignore.includes(event[0]);
}

function filterFields (event) {
Expand Down
4 changes: 2 additions & 2 deletions tests/hijack/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Tinytest.add(
});
let client = GetMeteorClient();
let result = client.call(methodId);
let events = GetLastMethodEvents([0, 2]);
let events = GetLastMethodEvents([0, 2], ['async']);
let expected = [
['start',undefined,{userId: null, params: '[]'}],
['wait',undefined,{waitOn: []}],
Expand Down Expand Up @@ -174,7 +174,7 @@ Tinytest.add(
});
let client = GetMeteorClient();
let result = client.call(methodId);
let events = GetLastMethodEvents([0, 2]);
let events = GetLastMethodEvents([0, 2], ['async']);
let expected = [
['start',undefined,{userId: null, params: '[]'}],
['wait',undefined,{waitOn: []}],
Expand Down

0 comments on commit bc45bcf

Please sign in to comment.