{"id":14971361,"url":"https://github.com/o-holyshevskyi/intuitive-test-assertions","last_synced_at":"2026-06-20T20:51:09.711Z","repository":{"id":65563653,"uuid":"533313406","full_name":"o-holyshevskyi/intuitive-test-assertions","owner":"o-holyshevskyi","description":"Intuitive test assertions","archived":false,"fork":false,"pushed_at":"2023-07-29T22:33:05.000Z","size":279,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-15T06:29:41.937Z","etag":null,"topics":["assertions","automated-testing","automation","chai","fluent-assertions","javascript","jest","mocha","playwright","test-automation","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/intuitive-test-assertions","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/o-holyshevskyi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-06T12:29:12.000Z","updated_at":"2025-05-01T18:30:42.000Z","dependencies_parsed_at":"2025-01-04T20:51:57.387Z","dependency_job_id":null,"html_url":"https://github.com/o-holyshevskyi/intuitive-test-assertions","commit_stats":{"total_commits":82,"total_committers":3,"mean_commits":"27.333333333333332","dds":"0.13414634146341464","last_synced_commit":"7445007f14ad423e355514ff14735df1980bf865"},"previous_names":["holyaleks/intuitive-test-assertions"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/o-holyshevskyi/intuitive-test-assertions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o-holyshevskyi%2Fintuitive-test-assertions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o-holyshevskyi%2Fintuitive-test-assertions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o-holyshevskyi%2Fintuitive-test-assertions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o-holyshevskyi%2Fintuitive-test-assertions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/o-holyshevskyi","download_url":"https://codeload.github.com/o-holyshevskyi/intuitive-test-assertions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o-holyshevskyi%2Fintuitive-test-assertions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34585195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assertions","automated-testing","automation","chai","fluent-assertions","javascript","jest","mocha","playwright","test-automation","typescript"],"created_at":"2024-09-24T13:45:05.171Z","updated_at":"2026-06-20T20:51:09.694Z","avatar_url":"https://github.com/o-holyshevskyi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n  \u003ca href=\"\"\u003e[![git_package](https://img.shields.io/github/package-json/v/holyaleks/intuitive-test-assertions?style=plastic)](https://github.com/holyaleks/intuitive-test-assertions/pkgs/npm/intuitive-test-assertions)\u003c/a\u003e\n  \u003ca href=\"\"\u003e[![downloads](https://img.shields.io/npm/dw/intuitive-test-assertions?style=plastic)](https://www.npmjs.com/package/intuitive-test-assertions)\u003c/a\u003e\n  \u003ca href=\"\"\u003e[![checks](https://img.shields.io/github/checks-status/holyaleks/intuitive-test-assertions/main?style=plastic)](https://github.com/holyaleks/intuitive-test-assertions/actions) \u003c/a\u003e\n  \u003ca href=\"\"\u003e[![follow](https://img.shields.io/github/forks/holyaleks/intuitive-test-assertions?style=social)](https://github.com/holyaleks/intuitive-test-assertions)\u003c/a\u003e\n\n\u003c/div\u003e\n\n# Intuitive Assertion\n[![npm](https://img.shields.io/npm/v/intuitive-test-assertions?style=plastic)](https://www.npmjs.com/package/intuitive-test-assertions) \n\nInstall the Intuitive test assertions package in your application\n\n```npm\nnpm i intuitive-test-assertions\n```\n\n# See release\n[![npm](https://img.shields.io/github/v/release/holyaleks/intuitive-test-assertions?style=plastic)](https://github.com/holyaleks/intuitive-test-assertions/releases/tag/v1.1.8)\n\nRelease is available for library\n\n# Available assertions\n\nIntuitive assertions are available for different types in [TypeScript language](https://www.typescriptlang.org/docs/handbook/basic-types.html). Start using library importing `intuitive-test-assertions` in your file\n\n```TypeScript\n// *.test.ts file\nimport 'intuitive-test-assertions';\n```\n\nAfter importing this library you are able to use Intuitive Test Assertions in your tests.\n\n## Boolean\n\n```TypeScript\n// *.test.ts file\nimport 'intuitive-test-assertions';\n\nfunction foo(): boolean {\n    return true;\n}\n\nconst bool = foo();\n\nbool.must().be(true);\nbool.must().beTrue();\n// if you want to verify something opposite, use the not property\nbool.must().not.beFalse();\nbool.must().not.be(false);\n\nbool.must().beFalse(); // the message will be thrown: 'Expected value to be 'False', but found 'true''\n```\n\n## Number\n\n```TypeScript\n// *.test.ts file\nimport 'intuitive-test-assertions';\n\nfunction foo(): number {\n    return 5;\n}\n\nconst numb = foo();\n\nnumb.must().be(5);\nnumb.must().beGreaterOrEqualTo(5);\nnumb.must().beGreaterThan(4);\nnumb.must().beLesserOrEqualTo(5);\nnumb.must().beLesserThan(6);\nnumb.must().beInRange(0, 10);\nnumb.must().beInteger();\nnumb.must().bePositive();\n// if you want to verify something opposite, use the not property\nnumb.must().not.beNegative();\n\nnumb.must().beInRange(10, 12); // the message will be thrown: 'Expected value '5' to be between '10' and '12', but value is out of this range'\n```\n\n## Array\n\n```TypeScript\n// *.test.ts file\nimport 'intuitive-test-assertions';\n\nfunction foo(): Array\u003cnumber\u003e {\n    return [ 1, 2, 3, 4, 5, 6 ];\n}\n\nconst arr = foo();\n\narr.must().be([ 1, 2, 3, 4, 5, 6 ]);\narr.must().not.beEmpty();\narr.must().beSortedInASC();\n// if you want to verify something opposite, use the not property\narr.must().not.beSortedInDESC();\narr.must().contains(3);\narr.must().containsType('number');\narr.must().endsWith([ 4, 5, 6 ]);\narr.must().equalsTo([ 1, 2, 3, 4, 5, 6 ]);\narr.must().haveLength(6);\narr.must().haveLengthEqualOrGreaterThan(5);\narr.must().haveLengthEqualOrLesserThan(7);\narr.must().haveSameLengthAs([ 1, 2, 3, 4, 5, 6 ]);\narr.must().startsWith([ 1, 2, 3 ]);\n\narr.must().haveSameLengthAs([ 's', 's', 's']); // the message will be thrown: 'Expected collection has length '3', but found '6''\n```\n\n## Object\n\n```TypeScript\n// *.test.ts file\nimport 'intuitive-test-assertions';\n\nfunction foo(): Object {\n    return { firstElement: 1, secondElement: null, thirdElement: undefined };\n}\n\nconst obj = foo();\n\n// if you want to verify something opposite, use the not property\nobj.must().not.beEmpty(); \nobj.must().contains((object) =\u003e object.subject.firstElement === 1);\nobj.must().containsKey('secondElement');\nobj.must().containsNullOrUndefined();\nobj.must().haveLength(3);\nobj.must().haveLengthEqualOrGreaterThan(2);\nobj.must().haveLengthEqualOrLesserThan(4);\n\nobj.must().contains((obj) =\u003e obj.subject.firstElement === 5 ) // the message will be thrown: \n// 'Expected collection { obj.subject.firstElement === 5; }, but found {\"firstElement\":1,\"secondElement\":2,\"thirdElement\":3}}'\n```\n\n## Date\n\n```TypeScript\n// *.test.ts file\nimport 'intuitive-test-assertions';\n\nfunction foo(): Date {\n    return new Date(2022, 1, 1, 10, 55, 15);\n}\n\nconst date = foo();\n\ndate.must().be(new Date(2022, 1, 1, 10, 55, 15));\ndate.must().beAfter(new Date(2022, 1, 1, 9, 55, 15));\ndate.must().beBefore(new Date(2022, 9, 17));\ndate.must().beInDateRange(new Date(2021, 12, 31), new Date(2022, 12, 31));\ndate.must().beOnOrAfter(new Date(2022, 1, 1, 8, 55, 15));\ndate.must().beOnOrBefore(new Date(2022, 1, 1, 11, 55, 15));\ndate.must().beOneOf([ new Date(2022, 1, 1, 10, 55, 15), new Date(2022, 1, 1, 9, 55, 15), new Date(2022, 1, 1, 8, 55, 15) ]);\ndate.must().bePrecisely(new Date(2022, 1, 1, 10, 55, 15).getTime());\ndate.must().containsDate(1);\ndate.must().containsDayOfWeek(5);\ndate.must().containsHours(10);\ndate.must().containsMinutes(55);\ndate.must().containsMonth(1);\ndate.must().containsSeconds(15);\ndate.must().containsYear(2022);\n\ndate.must().beOneOf([ new Date(2000, 4, 13), new Date(2000, 4, 25) ]); // the message will be thrown: \n// 'Expected date be at least one of '\"5/13/2000\", \"5/25/2000\"', but found '1/1/2022''\n```\n\n## String\n\n```TypeScript\n// *.test.ts file\nimport 'intuitive-test-assertions';\n\nfunction foo(): string {\n    return 'Intuitive test assertions';\n}\n\nconst str = foo();\n\nstr.must().be('Intuitive test assertions');\n// if you want to verify something opposite, use the not property\nstr.must().not.beEmptyOrWhiteSpace();\nstr.must().contains('test');\nstr.must().containsAll([ 'Intuitive', 'test', 'assertions' ]);\nstr.must().containsAny([ 'Intuitive' ]);\nstr.must().endsWith('assertions');\nstr.must().startsWith('Intuitive');\nstr.must().hasLength(26);\nstr.must().match(/.+/gm);\n\nstr.must().beEmptyOrWhiteSpace(); // the message will be thrown: \n// 'Expected be empty or white space, but found 'Intuitive test assertions''\n```\n\n## Function\n\nCurrently library provides some of asserts for functions. See examples bellow\n\n```TypeScript\n// *.test.ts file\nimport 'intuitive-test-assertions';\n\nfunction foo(): number {\n    return 2;\n}\n\nfoo.must().returnsType('number');\n// if you want to verify something opposite, use the not property\nfoo.must().not.haveName('bar');\n```\nIn the example below we are able to check if the function will be thrown. There are available two ways how you can do it\n\n```TypeScript\n// *.test.ts file\nimport { must } from 'intuitive-test-assertions';\n\n// function with parameters\nfunction foo(a: number): number {\n    if (a \u003e 0) {\n        return a;\n    } else {\n        throw new Error('Test is thrown');\n    }\n}\n\n// must be asserted with following code\nmust(() =\u003e foo(-1)).beThrown();\n\n// function without parameters\nfunction bar(): number {\n    return 10;\n}\n\n// can be asserted with both available ways\nmust(() =\u003e bar()).not.beThrown();\nbar.must().not.beThrown();\n```\n\n## Multiple assertion statements in one row\n\nIf you want to check something with two or more statements in one row use `and` property\n\n```TypeScript\n// *.test.ts file\nimport 'intuitive-test-assertions';\n\nfunction foo(): Array\u003cnumber\u003e {\n    return [ 1, 2, 3, 4, 5, 6 ];\n}\n\nconst arr = foo();\n\n// if you want to check something with two or more statements in one row use and property\narr.must().not.beEmpty().and.haveLength(6);\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo-holyshevskyi%2Fintuitive-test-assertions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fo-holyshevskyi%2Fintuitive-test-assertions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo-holyshevskyi%2Fintuitive-test-assertions/lists"}