Skip to content
On this page

Empower Your Test Results with AI-Powered Insights ->

oneOf

Checks if actual value is one of the expected value.

Syntax

js
oneOf(input)

Usage

โœ… Correct Usage

js
oneOf(["male", "female"])

Arguments

> input (string[])

checks if actual value oneOf the given element in the input array

Examples

js
const { spec } = require('pactum');
const { oneOf } = require('pactum-matchers');

await spec()
  .get('https://randomuser.me/api')
  .expectJsonMatch({
    "results": [
      {
        "gender": oneOf(["male", "female"]),
      }
    ]
  });

Released under the MIT License.