/**
* GPII PackageKit Device Reporter Tests
*
* Copyright 2014 Emergya
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* You may obtain a copy of the License at
* https://github.com/GPII/linux/blob/master/LICENSE.txt
*
* The research leading to these results has received funding from the European Union's
* Seventh Framework Programme (FP7/2007-2013)
* under grant agreement no. 289016.
*/
"use strict";
var fluid = require("universal"),
gpii = fluid.registerNamespace("gpii"),
jqUnit = fluid.require("node-jqunit");
require("packagekit");
fluid.registerNamespace("gpii.packageKit");
var originalCache = fluid.copy(gpii.packageKit.installedPackagesCache);
jqUnit.module("GPII PackageKit Device Reporter", {
setup: function () {
// mock-up of installedPackagesCache
//
gpii.packageKit.installedPackagesCache = [
{
"id": "foo_id",
"name": "foo",
"version": "foo_version",
"data": "installed"
}
];
},
teardown: function () {
gpii.packageKit.installedPackagesCache = originalCache;
}
});
jqUnit.test("Running tests for PackageKit Device Reporter", function () {
jqUnit.expect(2);
jqUnit.assertTrue("Check the availability of 'foo' through 'find' method",
gpii.packageKit.find("foo"));
jqUnit.assertFalse("Look for 'fooo' package", gpii.packageKit.find("fooo"));
});
|