Menu
Open source

toBeGreaterThanOrEqual()

The toBeGreaterThanOrEqual() method asserts that a numeric value is greater than or equal to another value.

Syntax

JavaScript
expect(actual).toBeGreaterThanOrEqual(expected);
expect(actual).not.toBeGreaterThanOrEqual(expected);

Parameters

ParameterTypeDescription
expectednumberThe value to compare against

Returns

TypeDescription
voidNo return value

Description

The toBeGreaterThanOrEqual() method performs a numeric comparison using the >= operator. Both values must be numbers, or the assertion will fail.

Usage

JavaScript
import { expect } from 'http://jslib.k6.io/k6-testing/0.5.0/index.js';

export default function () {
  expect(5).toBeGreaterThanOrEqual(3);
  expect(5).toBeGreaterThanOrEqual(5); // Equal values pass
  expect(10.5).toBeGreaterThanOrEqual(10);
  expect(0).toBeGreaterThanOrEqual(-1);
  expect(-1).toBeGreaterThanOrEqual(-5);
}