11import * as _ from 'underscore'
2- import { MongoMock } from './mongo'
32import type { DDP } from 'meteor/ddp'
43
54let controllableDefer = false
@@ -11,27 +10,14 @@ export function useNextTickDefer(): void {
1110 controllableDefer = false
1211}
1312
14- namespace Meteor {
13+ export namespace Meteor {
1514 export interface Settings {
1615 public : {
1716 [ id : string ] : any
1817 }
1918 [ id : string ] : any
2019 }
2120
22- export interface UserEmail {
23- address : string
24- verified : boolean
25- }
26- export interface User {
27- _id ?: string
28- username ?: string
29- emails ?: UserEmail [ ]
30- createdAt ?: number
31- profile ?: any
32- services ?: any
33- }
34-
3521 export interface ErrorStatic {
3622 new ( error : string | number , reason ?: string , details ?: string ) : Error
3723 }
@@ -89,7 +75,6 @@ export namespace MeteorMock {
8975 export const settings : any = { }
9076
9177 export const mockMethods : { [ name : string ] : Function } = { }
92- export let mockUser : Meteor . User | undefined = undefined
9378 export const mockStartupFunctions : Function [ ] = [ ]
9479
9580 export function status ( ) : DDP . DDPStatus {
@@ -100,15 +85,8 @@ export namespace MeteorMock {
10085 }
10186 }
10287
103- export function user ( ) : Meteor . User | undefined {
104- return mockUser
105- }
106- export function userId ( ) : string | undefined {
107- return mockUser ? mockUser . _id : undefined
108- }
10988 function getMethodContext ( ) {
11089 return {
111- userId : mockUser ? mockUser . _id : undefined ,
11290 connection : {
11391 clientAddress : '1.1.1.1' ,
11492 } ,
@@ -223,7 +201,6 @@ export namespace MeteorMock {
223201 export function bindEnvironment ( _fcn : Function ) : any {
224202 throw new Error ( 500 , 'bindEnvironment not supported on client' )
225203 }
226- export let users : MongoMock . Collection < any > | undefined = undefined
227204
228205 // -- Mock functions: --------------------------
229206 /**
@@ -236,12 +213,6 @@ export namespace MeteorMock {
236213
237214 await waitTimeNoFakeTimers ( 10 ) // So that any observers or defers has had time to run.
238215 }
239- export function mockLoginUser ( newUser : Meteor . User ) : void {
240- mockUser = newUser
241- }
242- export function mockSetUsersCollection ( usersCollection : MongoMock . Collection < any > ) : void {
243- users = usersCollection
244- }
245216
246217 /** Wait for time to pass ( unaffected by jest.useFakeTimers() ) */
247218 export async function sleepNoFakeTimers ( time : number ) : Promise < void > {
0 commit comments