mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 19:01:28 +00:00
Compare commits
1 Commits
solution22
...
eslint/fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a1e9f7231 |
@@ -44,8 +44,6 @@ src/Explorer/DataSamples/ContainerSampleGenerator.test.ts
|
|||||||
src/Explorer/DataSamples/ContainerSampleGenerator.ts
|
src/Explorer/DataSamples/ContainerSampleGenerator.ts
|
||||||
src/Explorer/DataSamples/DataSamplesUtil.test.ts
|
src/Explorer/DataSamples/DataSamplesUtil.test.ts
|
||||||
src/Explorer/DataSamples/DataSamplesUtil.ts
|
src/Explorer/DataSamples/DataSamplesUtil.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.test.ts
|
|
||||||
src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts
|
|
||||||
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.test.ts
|
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.test.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.ts
|
src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.ts
|
||||||
src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts
|
src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ describe("Cache arrays by key", () => {
|
|||||||
const key = "key";
|
const key = "key";
|
||||||
cache.insert(key, 1, 0);
|
cache.insert(key, 1, 0);
|
||||||
cache.clear();
|
cache.clear();
|
||||||
expect(cache.retrieve(key, 0, 1)).toBe(null);
|
expect(cache.retrieve(key, 0, 1)).toBe(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should invalidate oldest key to keep cache size under maximum", () => {
|
it("should invalidate oldest key to keep cache size under maximum", () => {
|
||||||
@@ -21,7 +21,7 @@ describe("Cache arrays by key", () => {
|
|||||||
cache.insert(key1, 2, 4);
|
cache.insert(key1, 2, 4);
|
||||||
|
|
||||||
expect(cache.retrieve(key1, 0, 3)).toEqual([0, 2, 4]);
|
expect(cache.retrieve(key1, 0, 3)).toEqual([0, 2, 4]);
|
||||||
expect(cache.retrieve(key2, 1, 1)).toEqual(null);
|
expect(cache.retrieve(key2, 1, 1)).toEqual(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should cache and retrieve cached page within boundaries", () => {
|
it("should cache and retrieve cached page within boundaries", () => {
|
||||||
@@ -39,7 +39,7 @@ describe("Cache arrays by key", () => {
|
|||||||
const key = "key";
|
const key = "key";
|
||||||
cache.insert(key, 0, 0);
|
cache.insert(key, 0, 0);
|
||||||
cache.insert(key, 1, 1);
|
cache.insert(key, 1, 1);
|
||||||
expect(cache.retrieve(key, 2, 1)).toEqual(null);
|
expect(cache.retrieve(key, 2, 1)).toEqual(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not retrieve cached page overlapping boundaries", () => {
|
it("should not retrieve cached page overlapping boundaries", () => {
|
||||||
@@ -48,7 +48,7 @@ describe("Cache arrays by key", () => {
|
|||||||
cache.insert(key, 0, 0);
|
cache.insert(key, 0, 0);
|
||||||
cache.insert(key, 1, 1);
|
cache.insert(key, 1, 1);
|
||||||
cache.insert(key, 2, 2);
|
cache.insert(key, 2, 2);
|
||||||
expect(cache.retrieve(key, 2, 4)).toEqual(null);
|
expect(cache.retrieve(key, 2, 4)).toEqual(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not insert non-contiguous element", () => {
|
it("should not insert non-contiguous element", () => {
|
||||||
@@ -57,7 +57,7 @@ describe("Cache arrays by key", () => {
|
|||||||
cache.insert(key, 0, 0);
|
cache.insert(key, 0, 0);
|
||||||
cache.insert(key, 1, 1);
|
cache.insert(key, 1, 1);
|
||||||
cache.insert(key, 3, 3);
|
cache.insert(key, 3, 3);
|
||||||
expect(cache.retrieve(key, 3, 1)).toEqual(null);
|
expect(cache.retrieve(key, 3, 1)).toEqual(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should cache multiple keys", () => {
|
it("should cache multiple keys", () => {
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ export class ArraysByKeyCache<T> {
|
|||||||
* @param pageSize
|
* @param pageSize
|
||||||
*/
|
*/
|
||||||
public retrieve(key: string, startIndex: number, pageSize: number): T[] | null {
|
public retrieve(key: string, startIndex: number, pageSize: number): T[] | null {
|
||||||
if (!this.cache.hasOwnProperty(key)) {
|
if (!Object.prototype.hasOwnProperty.call(this.cache, key)) {
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
const elements = this.cache[key];
|
const elements = this.cache[key];
|
||||||
if (startIndex + pageSize > elements.length) {
|
if (startIndex + pageSize > elements.length) {
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return elements.slice(startIndex, startIndex + pageSize);
|
return elements.slice(startIndex, startIndex + pageSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user