Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #54 Remove the Globals chapter #55

Merged
merged 3 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/client-side.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ You have now learned how to write a test for a React component using Jest and Re
Now that we have some tests, it may be useful to store coverage reports in a tool that can show progress over time.
One such tool is Codecov.

The following chapter will show you how to integrate <<coverage#,Codecov>> with your project.
The following chapter will show you how to integrate <<codecov#,Codecov>> with your project.
128 changes: 0 additions & 128 deletions docs/globals.adoc

This file was deleted.

16 changes: 10 additions & 6 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ TIP: For more details, visit the https://jestjs.io/[Jest documentation^].

This guide will show you how to:

* Create a <<project#,Project>> with Jest environment already setup.
* Write a simple <<test#,test>> without any mocks
* Write a test mocking <<globals#,Globals>>
* Write a test for server-side code manually <<mock#,mocking>> Java libraries
* Write a test for server-side code using <<mock-xp#, Mock XP>>
* Write a test for <<client-side#, client-side>> code
1. Create a <<project#,Project>> with Jest environment already set up.
2. Write a simple <<test#,test>> without any mocks
3. Write a test for server-side code manually <<mock#,mocking>> Java libraries
4. Write a test for server-side code using <<mock-xp#, Mock XP>>
5. Write a test for <<client-side#, client-side>> code

== Advanced topics

In addition to the main topics, you might want to learn about these advanced topics:

* Set up <<coverage#,Coverage>> with Github Actions
* <<colocation#,Colocate>> tests with the code they test

Expand Down
27 changes: 14 additions & 13 deletions docs/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@
"document": "test"
},
{
"title": "3 - Globals",
"document": "globals"
},
{
"title": "4 - Functions",
"title": "3 - Mocking",
"document": "mock"
},
{
"title": "5 - Mock XP",
"title": "4 - Mock XP",
"document": "mock-xp"
},
{
"title": "6 - Client side",
"title": "5 - Client side",
"document": "client-side"
},
{
"title": "7 - Codecov",
"document": "codecov"
},
{
"title": "8 - Colocation",
"document": "colocation"
"title": "Advanced",
"menuItems": [
{
"title": "Codecov",
"document": "codecov"
},
{
"title": "Colocation",
"document": "colocation"
}
]
}
]
}
8 changes: 6 additions & 2 deletions docs/mock.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
= Mocking functions
= Mocking
:sourcedir: ../

This chapter covers mocking functions and Enonic libraries.
This chapter introduces the concept of `mocking`. It shows how to mock functions and Enonic libraries.

== Introduction

Mocking is the concept of creating fake functions or objects that stand in for real functions or objects in the system. This way, you may test or simulate parts of a system - even without that system being actually available.

== Source code

Expand Down
2 changes: 1 addition & 1 deletion docs/test.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ Ran all test suites matching /src\/jest\/server\/fibonacci.test.ts/i.

This chapter explained how to write and run a simple Jest test for an Enonic XP project.

In order to write more advanced tests, we must introduce a new concept. Let's have a look at <<globals#,mocking>>.
In order to write more advanced tests, we must introduce a new concept. Let's have a look at <<mock#,mocking>>.
34 changes: 0 additions & 34 deletions src/jest/server/getAppConfig.test.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/main/resources/assets/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
],

"compilerOptions": {
"esModuleInterop": true,
"jsx": "react",
"lib": [
"DOM", // console, document, window, etc...
Expand Down
6 changes: 0 additions & 6 deletions src/main/resources/lib/myproject/getAppConfig.ts

This file was deleted.

Loading