1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/utils/cyclicIterator.test.ts
Christopher Kolstad 23094b016e
feat: first draft of chart for instance traffic in frontend (#2670)
## What
We've already added the backend for this. This is the initial work for
drawing a chart for instance traffic in the frontend. It requires the environment variable `PROMETHEUS_API` set to a valid prometheus-query-language (promql) supported backend, such as Prometheus itself or Victoria Metrics. Besides, at the moment we're hiding this functionality behind the flag `UNLEASH_EXPERIMENTAL_NETWORK_VIEW` which has to be set to true

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
2022-12-15 08:47:07 +00:00

15 lines
517 B
TypeScript

import { CyclicIterator } from './cyclicIterator';
test('loops around the list', () => {
const iterator = new CyclicIterator<number>([1, 3, 5, 7]);
expect(iterator.next()).toEqual(1);
expect(iterator.next()).toEqual(3);
expect(iterator.next()).toEqual(5);
expect(iterator.next()).toEqual(7);
expect(iterator.next()).toEqual(1);
expect(iterator.next()).toEqual(3);
expect(iterator.next()).toEqual(5);
expect(iterator.next()).toEqual(7);
expect(iterator.next()).toEqual(1);
});