import expect from 'expect' ; import { kernel } from '../../src/utils/IOC' ; export function deepEqual ( obj1 , obj2 ) { expect ( Object . keys ( obj1 ) . sort ( ) ) . toEqual ( Object . keys ( obj2 ) . sort ( ) ) ; let keys = Object . keys ( obj1 ) ; for ( let key of keys ) { expect ( obj1 [ key ] ) . toEqual ( obj2 [ key ] ) ; } } export function getSingletonMock < T > ( target , mock ) { kernel . unbind ( target ) ; kernel . bind < T > ( target ) . to ( mock ) . inSingletonScope ( ) ; return kernel . get < T > ( target ) ; } export function bindMock ( target , mock ) { kernel . unbind ( target ) ; kernel . bind ( target ) . toConstantValue ( mock ) ; } export function getDockerEvent ( id , action ) { return { id , Action : action } ; } export function getDockerSwarmEvent ( id , status ) { return { id , status } ; }