Skip to content

Commit

Permalink
Fix #54 Remove the Globals chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
ComLock committed May 14, 2024
1 parent e734baf commit ff7efdf
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 191 deletions.
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 setup.
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.

6 changes: 0 additions & 6 deletions src/main/resources/lib/myproject/getAppConfig.ts

This file was deleted.

0 comments on commit ff7efdf

Please sign in to comment.