argo-cd

Форк
0
/
label-selector.test.ts 
45 строк · 1.8 Кб
1
import * as LabelSelector from './label-selector';
2

3
test('exists', () => {
4
    expect(LabelSelector.match('test', {test: 'hello'})).toBeTruthy();
5
    expect(LabelSelector.match('test1', {test: 'hello'})).toBeFalsy();
6
    expect(LabelSelector.match('app.kubernetes.io/instance', {'app.kubernetes.io/instance': 'hello'})).toBeTruthy();
7
});
8

9
test('not exists', () => {
10
    expect(LabelSelector.match('!test', {test: 'hello'})).toBeFalsy();
11
    expect(LabelSelector.match('!test1', {test: 'hello'})).toBeTruthy();
12
});
13

14
test('in', () => {
15
    expect(LabelSelector.match('test in 1, 2, 3', {test: '1'})).toBeTruthy();
16
    expect(LabelSelector.match('test in 1, 2, 3', {test: '4'})).toBeFalsy();
17
    expect(LabelSelector.match('test in 1, 2, 3', {test1: '1'})).toBeFalsy();
18
});
19

20
test('notIn', () => {
21
    expect(LabelSelector.match('test notin 1, 2, 3', {test: '1'})).toBeFalsy();
22
    expect(LabelSelector.match('test notin 1, 2, 3', {test: '4'})).toBeTruthy();
23
    expect(LabelSelector.match('test notin 1, 2, 3', {test1: '1'})).toBeTruthy();
24
});
25

26
test('equal', () => {
27
    expect(LabelSelector.match('test=hello', {test: 'hello'})).toBeTruthy();
28
    expect(LabelSelector.match('test=world', {test: 'hello'})).toBeFalsy();
29
    expect(LabelSelector.match('test==hello', {test: 'hello'})).toBeTruthy();
30
});
31

32
test('notEqual', () => {
33
    expect(LabelSelector.match('test!=hello', {test: 'hello'})).toBeFalsy();
34
    expect(LabelSelector.match('test!=world', {test: 'hello'})).toBeTruthy();
35
});
36

37
test('greaterThen', () => {
38
    expect(LabelSelector.match('test gt 1', {test: '2'})).toBeTruthy();
39
    expect(LabelSelector.match('test gt 3', {test: '2'})).toBeFalsy();
40
});
41

42
test('lessThen', () => {
43
    expect(LabelSelector.match('test lt 1', {test: '2'})).toBeFalsy();
44
    expect(LabelSelector.match('test lt 3', {test: '2'})).toBeTruthy();
45
});
46

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.