mirror of
https://github.com/nasa/openmct.git
synced 2025-03-15 16:45:19 +00:00
[Search] Update tests
Update generic search worker and provider tests for changes to worker scoring order.
This commit is contained in:
parent
a55607dc23
commit
e4639091e5
@ -172,10 +172,10 @@ define(
|
||||
event = {
|
||||
data: {
|
||||
request: "search",
|
||||
results: {
|
||||
1: 1,
|
||||
2: 2
|
||||
},
|
||||
results: [
|
||||
{id: 1, score: 1},
|
||||
{id: 2, score: 2}
|
||||
],
|
||||
total: 2,
|
||||
timedOut: false,
|
||||
timestamp: timestamp
|
||||
|
@ -35,7 +35,17 @@ define(
|
||||
numObjects = 5;
|
||||
|
||||
beforeEach(function () {
|
||||
var i;
|
||||
// See first it()
|
||||
});
|
||||
|
||||
it("searches can reach all objects", function () {
|
||||
var flag = false,
|
||||
workerOutput,
|
||||
resultsLength = 0,
|
||||
i;
|
||||
|
||||
// This for loop is being done only once in the first it() becuase
|
||||
// duplicate checking is done outside fo the worker
|
||||
for (i = 0; i < numObjects; i += 1) {
|
||||
worker.postMessage(
|
||||
{
|
||||
@ -49,12 +59,6 @@ define(
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it("searches can reach all objects", function () {
|
||||
var flag = false,
|
||||
workerOutput,
|
||||
resultsLength = 0;
|
||||
|
||||
// Search something that should return all objects
|
||||
runs(function () {
|
||||
@ -70,12 +74,8 @@ define(
|
||||
});
|
||||
|
||||
worker.onmessage = function (event) {
|
||||
var id;
|
||||
|
||||
workerOutput = event.data;
|
||||
for (id in workerOutput.results) {
|
||||
resultsLength += 1;
|
||||
}
|
||||
resultsLength = event.data.results.length;
|
||||
flag = true;
|
||||
};
|
||||
|
||||
@ -108,12 +108,8 @@ define(
|
||||
});
|
||||
|
||||
worker.onmessage = function (event) {
|
||||
var id;
|
||||
|
||||
workerOutput = event.data;
|
||||
for (id in workerOutput.results) {
|
||||
resultsLength += 1;
|
||||
}
|
||||
resultsLength = event.data.results.length;
|
||||
flag = true;
|
||||
};
|
||||
|
||||
@ -124,7 +120,6 @@ define(
|
||||
runs(function () {
|
||||
expect(workerOutput).toBeDefined();
|
||||
expect(resultsLength).toEqual(1);
|
||||
expect(workerOutput.results[2]).toBeDefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user