{"id":16222164,"url":"https://github.com/hugodf/jest-specific-argument-assert","last_synced_at":"2025-04-08T00:46:52.774Z","repository":{"id":38290884,"uuid":"183948774","full_name":"HugoDF/jest-specific-argument-assert","owner":"HugoDF","description":"Jest assert over single or specific argument/parameters with .toHaveBeenCalledWith and expect.anything()","archived":false,"fork":false,"pushed_at":"2023-01-06T02:50:25.000Z","size":778,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T01:39:38.217Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://codewithhugo.com/jest-specific-argument-parameter-assert/","language":"JavaScript","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/HugoDF.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-28T19:15:06.000Z","updated_at":"2021-12-04T09:19:55.000Z","dependencies_parsed_at":"2023-02-05T03:47:09.896Z","dependency_job_id":null,"html_url":"https://github.com/HugoDF/jest-specific-argument-assert","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoDF%2Fjest-specific-argument-assert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoDF%2Fjest-specific-argument-assert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoDF%2Fjest-specific-argument-assert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoDF%2Fjest-specific-argument-assert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HugoDF","download_url":"https://codeload.github.com/HugoDF/jest-specific-argument-assert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755588,"owners_count":20990626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-10T12:11:30.407Z","updated_at":"2025-04-08T00:46:52.756Z","avatar_url":"https://github.com/HugoDF.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jest-specific-argument-assert\n\n\u003e Jest assert over single or specific argument/parameters with .toHaveBeenCalledWith and expect.anything()\n\nSee it in action at https://codesandbox.io/s/github/HugoDF/jest-specific-argument-assert/tree/master/\n\nMost of the interesting things happen in [./src/pinger.test.js](./src/pinger.test.js).\n\nTo run the tests:\n\n- `npm install` (Node 10+, npm 6+)\n- `npm test` to run tests (or `npm test -- --coverage` to run with coverage)\n\nNote the use of `expect.anyting()` to ignore certain parameters to a function that aren't asserted against for specific tests.\n\n```js\n  describe('without search', () =\u003e {\n    test('calls getPingConfigs with right accountId, searchRegex', async () =\u003e {\n      await pinger(1);\n      expect(mockPingConfig).toHaveBeenCalledWith(\n        1,\n        expect.anything(),\n        expect.anything(),\n        new RegExp('.*')\n      );\n    });\n  });\n  describe('offset, limit', () =\u003e {\n    test('calls getPingConfigs with passed offset and limit', async () =\u003e {\n      await pinger(1, { offset: 20, limit: 100 });\n      expect(mockPingConfig).toHaveBeenCalledWith(\n        1,\n        20,\n        100,\n        expect.anything()\n      );\n    });\n    test('calls getPingConfigs with default offset and limit if undefined', async () =\u003e {\n      await pinger(1);\n      expect(mockPingConfig).toHaveBeenCalledWith(1, 0, 50, expect.anything());\n    });\n  });\n  describe('search', () =\u003e {\n    describe('single-word search', () =\u003e {\n      test('calls getPingConfigs with right accountId, searchRegex', async () =\u003e {\n        await pinger(1, {}, 'search');\n        expect(mockPingConfig).toHaveBeenCalledWith(\n          1,\n          expect.anything(),\n          expect.anything(),\n          new RegExp('search')\n        );\n      });\n    });\n    describe('multi-word search', () =\u003e {\n      test('calls getPingConfigs with right accountId, searchRegex', async () =\u003e {\n        await pinger(1, {}, 'multi word search');\n        expect(mockPingConfig).toHaveBeenCalledWith(\n          1,\n          expect.anything(),\n          expect.anything(),\n          new RegExp('multi|word|search')\n        );\n      });\n    });\n  });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugodf%2Fjest-specific-argument-assert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugodf%2Fjest-specific-argument-assert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugodf%2Fjest-specific-argument-assert/lists"}