Skip to content

Commit

Permalink
improves jest setup
Browse files Browse the repository at this point in the history
  • Loading branch information
dkress59 committed Aug 7, 2022
1 parent b6e17fe commit 4eb77f1
Show file tree
Hide file tree
Showing 76 changed files with 1,707 additions and 1,071 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn build
- run: yarn test __tests__/*.spec.ts
- run: yarn test

coverage:
runs-on: ubuntu-latest
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Install Dependencies
run: yarn
- name: Run Tests
run: yarn test --ci __tests__/*.spec.ts
run: yarn test --ci
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
Expand All @@ -61,6 +61,6 @@ jobs:
./__tests__/e2e/wait-for-db-import.sh
echo 'un-pausing: mysql is now available'
- name: Run end-to-end test
run: yarn test:e2e
run: yarn test:e2e --ci
- name: Tear down WordPress
run: yarn docker:down
14 changes: 0 additions & 14 deletions __snapshots__/e2e-status-authenticated.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@

exports[`End-to-end test .status authenticated 1`] = `
Object {
"acf-disabled": Object {
"_links": Object {
"archives": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/posts?status=acf-disabled",
},
],
},
"date_floating": false,
"name": "Disabled",
"public": true,
"queryable": true,
"slug": "acf-disabled",
},
"draft": Object {
"_links": Object {
"archives": Array [
Expand Down
14 changes: 0 additions & 14 deletions __snapshots__/e2e-status.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@

exports[`End-to-end test .status unauthenticated 1`] = `
Object {
"acf-disabled": Object {
"_links": Object {
"archives": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/posts?status=acf-disabled",
},
],
},
"date_floating": false,
"name": "Disabled",
"public": true,
"queryable": true,
"slug": "acf-disabled",
},
"publish": Object {
"_links": Object {
"archives": Array [
Expand Down
12 changes: 6 additions & 6 deletions __snapshots__/media/e2e-create.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ Object {
"replies": Array [
Object {
"embeddable": true,
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=17",
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=5",
},
],
"self": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/17",
"href": "http://localhost:8080/wp-json/wp/v2/media/5",
},
],
"wp:action-assign-author": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/17",
"href": "http://localhost:8080/wp-json/wp/v2/media/5",
},
],
"wp:action-unfiltered-html": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/17",
"href": "http://localhost:8080/wp-json/wp/v2/media/5",
},
],
},
Expand All @@ -65,7 +65,7 @@ Object {
"raw": "http://localhost:8080/wp-content/uploads/filename.jpg",
"rendered": "http://localhost:8080/wp-content/uploads/filename.jpg",
},
"id": 17,
"id": 5,
"link": "http://localhost:8080/filename/",
"media_details": Object {
"file": "filename.jpg",
Expand All @@ -92,7 +92,7 @@ Object {
"meta": Array [],
"mime_type": "image/jpeg",
"missing_image_sizes": Array [],
"permalink_template": "http://localhost:8080/?attachment_id=17",
"permalink_template": "http://localhost:8080/?attachment_id=5",
"ping_status": "closed",
"post": null,
"slug": "filename",
Expand Down
12 changes: 6 additions & 6 deletions __snapshots__/media/e2e-create_png.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ Object {
"replies": Array [
Object {
"embeddable": true,
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=18",
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=6",
},
],
"self": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/18",
"href": "http://localhost:8080/wp-json/wp/v2/media/6",
},
],
"wp:action-assign-author": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/18",
"href": "http://localhost:8080/wp-json/wp/v2/media/6",
},
],
"wp:action-unfiltered-html": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/18",
"href": "http://localhost:8080/wp-json/wp/v2/media/6",
},
],
},
Expand All @@ -65,7 +65,7 @@ Object {
"raw": "http://localhost:8080/wp-content/uploads/filename.png",
"rendered": "http://localhost:8080/wp-content/uploads/filename.png",
},
"id": 18,
"id": 6,
"link": "http://localhost:8080/filename/",
"media_details": Object {
"file": "filename.png",
Expand All @@ -92,7 +92,7 @@ Object {
"meta": Array [],
"mime_type": "image/png",
"missing_image_sizes": Array [],
"permalink_template": "http://localhost:8080/?attachment_id=18",
"permalink_template": "http://localhost:8080/?attachment_id=6",
"ping_status": "closed",
"post": null,
"slug": "filename",
Expand Down
12 changes: 6 additions & 6 deletions __snapshots__/media/e2e-create_populated.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ Object {
"replies": Array [
Object {
"embeddable": true,
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=19",
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=7",
},
],
"self": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/19",
"href": "http://localhost:8080/wp-json/wp/v2/media/7",
},
],
"wp:action-assign-author": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/19",
"href": "http://localhost:8080/wp-json/wp/v2/media/7",
},
],
"wp:action-unfiltered-html": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/19",
"href": "http://localhost:8080/wp-json/wp/v2/media/7",
},
],
},
Expand All @@ -65,7 +65,7 @@ Object {
"raw": "http://localhost:8080/wp-content/uploads/filename.jpg",
"rendered": "http://localhost:8080/wp-content/uploads/filename.jpg",
},
"id": 19,
"id": 7,
"link": "http://localhost:8080/mock_slug/",
"media_details": Object {
"file": "filename.jpg",
Expand All @@ -92,7 +92,7 @@ Object {
"meta": Array [],
"mime_type": "image/jpeg",
"missing_image_sizes": Array [],
"permalink_template": "http://localhost:8080/?attachment_id=19",
"permalink_template": "http://localhost:8080/?attachment_id=7",
"ping_status": "closed",
"post": null,
"slug": "mock_slug",
Expand Down
4 changes: 2 additions & 2 deletions __snapshots__/media/e2e-delete.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Array [
"raw": "http://localhost:8080/wp-content/uploads/filename.jpg",
"rendered": "http://localhost:8080/wp-content/uploads/filename.jpg",
},
"id": 20,
"id": 8,
"link": "http://localhost:8080/filename/",
"media_details": Object {
"file": "filename.jpg",
Expand All @@ -49,7 +49,7 @@ Array [
"meta": Array [],
"mime_type": "image/jpeg",
"missing_image_sizes": Array [],
"permalink_template": "http://localhost:8080/?attachment_id=20",
"permalink_template": "http://localhost:8080/?attachment_id=8",
"ping_status": "closed",
"post": null,
"slug": "filename",
Expand Down
6 changes: 3 additions & 3 deletions __snapshots__/media/e2e-find_all.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ Array [
"replies": Array [
Object {
"embeddable": true,
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=21",
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=9",
},
],
"self": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/21",
"href": "http://localhost:8080/wp-json/wp/v2/media/9",
},
],
},
Expand All @@ -74,7 +74,7 @@ Array [
"guid": Object {
"rendered": "http://localhost:8080/wp-content/uploads/filename.jpg",
},
"id": 21,
"id": 9,
"link": "http://localhost:8080/filename/",
"media_details": Object {
"file": "filename.jpg",
Expand Down
6 changes: 3 additions & 3 deletions __snapshots__/media/e2e-find_one.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ Array [
"replies": Array [
Object {
"embeddable": true,
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=22",
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=10",
},
],
"self": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/22",
"href": "http://localhost:8080/wp-json/wp/v2/media/10",
},
],
},
Expand All @@ -74,7 +74,7 @@ Array [
"guid": Object {
"rendered": "http://localhost:8080/wp-content/uploads/filename.jpg",
},
"id": 22,
"id": 10,
"link": "http://localhost:8080/filename/",
"media_details": Object {
"file": "filename.jpg",
Expand Down
12 changes: 6 additions & 6 deletions __snapshots__/media/e2e-update.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ Object {
"replies": Array [
Object {
"embeddable": true,
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=23",
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=11",
},
],
"self": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/23",
"href": "http://localhost:8080/wp-json/wp/v2/media/11",
},
],
"wp:action-assign-author": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/23",
"href": "http://localhost:8080/wp-json/wp/v2/media/11",
},
],
"wp:action-unfiltered-html": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media/23",
"href": "http://localhost:8080/wp-json/wp/v2/media/11",
},
],
},
Expand All @@ -65,7 +65,7 @@ Object {
"raw": "http://localhost:8080/wp-content/uploads/filename.jpg",
"rendered": "http://localhost:8080/wp-content/uploads/filename.jpg",
},
"id": 23,
"id": 11,
"link": "http://localhost:8080/filename/",
"media_details": Object {
"file": "filename.jpg",
Expand All @@ -92,7 +92,7 @@ Object {
"meta": Array [],
"mime_type": "image/jpeg",
"missing_image_sizes": Array [],
"permalink_template": "http://localhost:8080/?attachment_id=23",
"permalink_template": "http://localhost:8080/?attachment_id=11",
"ping_status": "closed",
"post": null,
"slug": "filename",
Expand Down
22 changes: 11 additions & 11 deletions __snapshots__/page/e2e-create.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,38 @@ Object {
"replies": Array [
Object {
"embeddable": true,
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=11",
"href": "http://localhost:8080/wp-json/wp/v2/comments?post=31",
},
],
"self": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/pages/11",
"href": "http://localhost:8080/wp-json/wp/v2/pages/31",
},
],
"version-history": Array [
Object {
"count": 0,
"href": "http://localhost:8080/wp-json/wp/v2/pages/11/revisions",
"href": "http://localhost:8080/wp-json/wp/v2/pages/31/revisions",
},
],
"wp:action-assign-author": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/pages/11",
"href": "http://localhost:8080/wp-json/wp/v2/pages/31",
},
],
"wp:action-publish": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/pages/11",
"href": "http://localhost:8080/wp-json/wp/v2/pages/31",
},
],
"wp:action-unfiltered-html": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/pages/11",
"href": "http://localhost:8080/wp-json/wp/v2/pages/31",
},
],
"wp:attachment": Array [
Object {
"href": "http://localhost:8080/wp-json/wp/v2/media?parent=11",
"href": "http://localhost:8080/wp-json/wp/v2/media?parent=31",
},
],
},
Expand All @@ -82,11 +82,11 @@ Object {
"featured_media": 0,
"generated_slug": "mock-title",
"guid": Object {
"raw": "http://localhost:8080/?page_id=11",
"rendered": "http://localhost:8080/?page_id=11",
"raw": "http://localhost:8080/?page_id=31",
"rendered": "http://localhost:8080/?page_id=31",
},
"id": 11,
"link": "http://localhost:8080/?page_id=11",
"id": 31,
"link": "http://localhost:8080/?page_id=31",
"menu_order": 0,
"meta": Array [],
"parent": 0,
Expand Down
Loading

0 comments on commit 4eb77f1

Please sign in to comment.