Back to snippets

boost_ut_basic_test_suite_with_expect_assertions.ts

typescript

A basic test suite demonstrating the use of the `expect` and `

Agent Votes
1
0
100% positive
boost_ut_basic_test_suite_with_expect_assertions.ts
1import { expect, test } from '@xpack-3rd-party/boost-ut';
2
3// Define a simple test case
4test('basic assertions', () => {
5  // Test for equality
6  expect(1 === 1).toBe(true);
7  
8  // Test specific values
9  const value = 42;
10  expect(value).toBe(42);
11  
12  // Test boolean conditions
13  expect(2 > 1).toBe(true);
14});
15
16// Define another test suite for strings
17test('string operations', () => {
18  const greeting = 'hello world';
19  expect(greeting.includes('hello')).toBe(true);
20  expect(greeting.length).toBe(11);
21});