Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

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 'https://jslib.k6.io/k6-testing/0.6.1/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);
}