Add more test coverage for compose/images

Closes: #1492
Change-type: patch
Signed-off-by: Miguel Casqueira <miguel@balena.io>
This commit is contained in:
Miguel Casqueira
2020-10-30 17:38:19 -04:00
parent d1380e15ca
commit cd0d53c39d
6 changed files with 666 additions and 28 deletions

28
test/lib/mocked-dbus.ts Normal file
View File

@ -0,0 +1,28 @@
import * as dbus from 'dbus';
import { DBusError, DBusInterface } from 'dbus';
import { stub } from 'sinon';
stub(dbus, 'getBus').returns({
getInterface: (
_serviceName: string,
_objectPath: string,
_interfaceName: string,
interfaceCb: (err: null | DBusError, iface: DBusInterface) => void,
) => {
interfaceCb(null, {
Get: (
_unitName: string,
_property: string,
getCb: (err: null | Error, value: unknown) => void,
) => {
getCb(null, 'this is the value');
},
GetUnit: (
_unitName: string,
getUnitCb: (err: null | Error, unitPath: string) => void,
) => {
getUnitCb(null, 'this is the unit path');
},
} as any);
},
} as any);