{"id":27197727,"url":"https://github.com/preaction/test-mojo-role-testdeep","last_synced_at":"2025-08-09T23:32:55.071Z","repository":{"id":36149264,"uuid":"40453287","full_name":"preaction/Test-Mojo-Role-TestDeep","owner":"preaction","description":"Add Test::Deep methods to Test::Mojo","archived":false,"fork":false,"pushed_at":"2016-11-12T04:04:27.000Z","size":33,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T20:43:15.366Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/preaction.png","metadata":{"files":{"readme":"README","changelog":"CHANGES","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-09T22:52:59.000Z","updated_at":"2016-11-12T04:04:28.000Z","dependencies_parsed_at":"2022-07-22T19:31:01.142Z","dependency_job_id":null,"html_url":"https://github.com/preaction/Test-Mojo-Role-TestDeep","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/preaction/Test-Mojo-Role-TestDeep","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preaction%2FTest-Mojo-Role-TestDeep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preaction%2FTest-Mojo-Role-TestDeep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preaction%2FTest-Mojo-Role-TestDeep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preaction%2FTest-Mojo-Role-TestDeep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/preaction","download_url":"https://codeload.github.com/preaction/Test-Mojo-Role-TestDeep/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/preaction%2FTest-Mojo-Role-TestDeep/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269653714,"owners_count":24454315,"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","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"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":[],"created_at":"2025-04-09T20:29:27.645Z","updated_at":"2025-08-09T23:32:55.019Z","avatar_url":"https://github.com/preaction.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"=head1 SYNOPSIS\n\n    use Test::Mojo::WithRoles 'TestDeep';\n    use Test::Deep; # Get Test::Deep comparison functions\n\n    my $t = Test::Mojo::WithRoles-\u003enew( 'MyApp' );\n\n    # Test JSON responses with Test::Deep\n    $t-\u003eget_ok( '/data.json' )\n      -\u003ejson_deeply(\n        superhashof( { foo =\u003e 'bar' } ),\n        'has at least a foo key with \"bar\" value',\n      );\n\n    # Test HTML with Test::Deep\n    $t-\u003eget_ok( '/index.html' )\n      -\u003etext_deeply(\n        'nav a',\n        [qw( Home Blog Projects About Contact )],\n        'nav link text matches site section titles',\n      )\n      -\u003eattr_deeply(\n        'nav a',\n        href =\u003e [qw( / /blog /projects /about /contact )],\n        'nav link href matches site section URLs',\n      );\n\n=head1 DESCRIPTION\n\nThis module adds some L\u003cTest::Deep\u003e functionality to L\u003cTest::Mojo\u003e.\nC\u003cTest::Deep\u003e allows for extremely-customizable testing of data\nstructures. This module adds some helper methods to C\u003cTest::Mojo\u003e (using\nL\u003cTest::Mojo::WithRoles\u003e) to test your web app's responses using\nC\u003cTest::Deep\u003e.\n\n=method json_deeply\n\n    $t-\u003ejson_deeply( $expect, $desc )\n    $t-\u003ejson_deeply( $ptr, $expect, $desc )\n\nTest that the current response (parsed as a JSON object) matches the given\ntests. C\u003c$expect\u003e is a data structure containing L\u003cTest::Deep\ncomparisons|Test::Deep/SPECIAL COMPARISONS PROVIDED\u003e to run. C\u003c$desc\u003e is an\noptional description of the test.\n\nIf given, C\u003c$ptr\u003e is a JSON pointer string to pick out a single part of the\ndata structure. This is more convenient than using Test::Deep's comparison\nroutines to do the same thing. See L\u003cMojo::JSON::Pointer\u003e.\n\nCorresponds to L\u003ccmp_deeply in Test::Deep|Test::Deep/COMPARISON FUNCTIONS\u003e.\n\n=head2 text_deeply\n\n    $t-\u003etext_deeply( $selector =\u003e $expect, $desc );\n\nTest the text of the elements matched by the given C\u003c$selector\u003e against\nthe given test. C\u003c$expect\u003e is a data structure containing L\u003cTest::Deep\ncomparisons|Test::Deep/SPECIAL COMPARISONS PROVIDED\u003e to run. C\u003c$desc\u003e is\nan optional description of the test.\n\nThe elements will always be an arrayref, even if only one\nelement matches.\n\nFor example:\n\n    # test.html\n    \u003cnav\u003e\n        \u003cul\u003e\n            \u003cli\u003e\u003ca href=\"/\"\u003eHome\u003c/a\u003e\u003c/li\u003e\n            \u003cli\u003e\u003ca href=\"/blog\"\u003eBlog\u003c/a\u003e\u003c/li\u003e\n            \u003cli\u003e\u003ca href=\"/projects\"\u003eProjects\u003c/a\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n    \u003c/nav\u003e\n\n    # test.t\n    $t-\u003eget_ok( 'test.html' )\n      -\u003etext_deeply(\n        'nav a' =\u003e [bag( Home Blog Projects )],\n        'nav element text is correct',\n      );\n\nThis is equivalent to:\n\n    $t-\u003eget_ok( 'test.html' );\n    my $dom = $t-\u003etx-\u003eres-\u003edom;\n    cmp_deeply\n        [ $dom-\u003efind( 'nav a' )-\u003emap( 'text' )-\u003eeach ],\n        [ bag( Home Blog Projects ) ],\n        'nav element text is correct';\n\n=head2 attr_deeply\n\n    $t-\u003eattr_deeply( $selector, $attr =\u003e $expect, ..., $desc );\n\nTest the given attributes of the elements matched by the given selector\nagainst the given test. C\u003c$expect\u003e is a data structure containing\nL\u003cTest::Deep comparisons|Test::Deep/SPECIAL COMPARISONS PROVIDED\u003e to\nrun. C\u003c$desc\u003e is an optional description of the test.\n\nThe element attributes will always be an arrayref, even if only one\nelement matches.\n\nFor example:\n\n    # test.html\n    \u003cform action=\"/search\" method=\"GET\"\u003e\n        ...\n    \u003c/form\u003e\n\n    # test.t\n    $t-\u003eget_ok( 'test.html' )\n      -\u003eattr_deeply(\n        'form',\n        action =\u003e [qw( /search )],\n        method =\u003e [re( qr( get )i )],\n        'form element is correct',\n      );\n\nThis is equivalent to:\n\n    $t-\u003eget_ok( 'test.html' );\n    my $dom = $t-\u003etx-\u003eres-\u003edom;\n    cmp_deeply\n        [ $dom-\u003efind( 'form' )-\u003emap( attr =\u003e 'action' )-\u003eeach ],\n        [ qw( /search ) ],\n        'form element action is correct',\n        ;\n    cmp_deeply\n        [ $dom-\u003efind( 'form' )-\u003emap( attr =\u003e 'method' )-\u003eeach ],\n        [ re( qr( get )i ) ],\n        'form element method is correct',\n        ;\n\n=head1 SEE ALSO\n\n=over 4\n\n=item L\u003cTest::Deep\u003e\n\n=item L\u003cTest::Mojo\u003e\n\n=item L\u003cTest::Mojo::WithRoles\u003e\n\n=back\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreaction%2Ftest-mojo-role-testdeep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpreaction%2Ftest-mojo-role-testdeep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpreaction%2Ftest-mojo-role-testdeep/lists"}