Skip to content

Commit fa6c3d2

Browse files
committed
fix(docs): update test paths to src/__tests__
1 parent c84388a commit fa6c3d2

8 files changed

+57
-57
lines changed

docs/site/Application-generator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ the following files and directories:
7676
```text
7777
.
7878
├── src/
79+
| ├── __tests__/
7980
| ├── controllers/
8081
| | └── ping.controller.ts
8182
| ├── datasources/
@@ -84,7 +85,6 @@ the following files and directories:
8485
| ├── application.ts
8586
| ├── index.ts
8687
| └── sequence.ts
87-
├── test/
8888
└── package.json
8989
```
9090

docs/site/Controllers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ codes is found
239239
The example below shows the previous controller revamped with `HttpErrors` along
240240
with a test to verify that the error is thrown properly.
241241

242-
{% include code-caption.html content="test/integration/controllers/hello.controller.integration.ts" %}
242+
{% include code-caption.html content="src/__tests__/integration/controllers/hello.controller.integration.ts" %}
243243

244244
```ts
245-
import {HelloController} from '../../../src/controllers';
246-
import {HelloRepository} from '../../../src/repositories';
245+
import {HelloController} from '../../../controllers';
246+
import {HelloRepository} from '../../../repositories';
247247
import {testdb} from '../../fixtures/datasources/testdb.datasource';
248248
import {expect} from '@loopback/testlab';
249249
import {HttpErrors} from '@loopback/rest';

docs/site/DEVELOPING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ tests (unit, acceptance and integration), with the convention
148148
Examples are:
149149

150150
```
151-
test/acceptance/application.acceptance.ts
152-
test/integration/user.controller.integration.ts
153-
test/unit/application.unit.ts
151+
src/__tests__/acceptance/application.acceptance.ts
152+
src/__tests__/integration/user.controller.integration.ts
153+
src/__tests__/unit/application.unit.ts
154154
```
155155

156156
## API Documentation

docs/site/Defining-the-API-using-design-first-approach.shelved.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ module provides a helper function for checking whether a specification conforms
408408
to OpenAPI Spec. Just add a new Mocha test that calls this helper function to
409409
the test suite:
410410

411-
{% include code-caption.html content="test/acceptance/api-spec.acceptance.ts" %}
411+
{% include code-caption.html content="src/__tests__/acceptance/api-spec.acceptance.ts" %}
412412

413413
```ts
414414
import {validateApiSpec} from '@loopback/testlab';

docs/site/Implementing-features.shelved.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ search for a given product name, and verify that expected products were
3535
returned. This verifies that all parts of your application are correctly wired
3636
together.
3737

38-
Create `test/acceptance/product.acceptance.ts` with the following contents:
38+
Create `src/__tests__/acceptance/product.acceptance.ts` with the following
39+
contents:
3940

4041
```ts
4142
import {HelloWorldApp} from '../..';
@@ -163,7 +164,7 @@ Run `npm test` and watch the test fail with a helpful error message:
163164

164165
```text
165166
TSError: ⨯ Unable to compile TypeScript
166-
test/unit/product-controller.test.ts (13,40): Property 'getDetails' does not exist on type 'ProductController'. (2339)
167+
src/__tests__/unit/product-controller.test.ts (13,40): Property 'getDetails' does not exist on type 'ProductController'. (2339)
167168
```
168169

169170
Now it's time to write the first implementation of the `getDetails` method.
@@ -412,8 +413,8 @@ Examine the acceptance test first. A quick review of the source code should tell
412413
us what's the problem - the test is relying on `givenEmptyDatabase` and
413414
`givenProduct` helpers, but these helpers are not fully implemented yet. Fix
414415
that by reusing the helpers from the integration test: Move the helpers to
415-
`test/helpers/database.helpers.ts` and update both the acceptance and the
416-
integration tests to import the helpers from there.
416+
`src/__tests__/helpers/database.helpers.ts` and update both the acceptance and
417+
the integration tests to import the helpers from there.
417418

418419
To find out why the API smoke test is failing, you can start the application via
419420
`node .` and request the tested endpoint for example using `curl`. You will see

docs/site/Testing-Your-Extensions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class PingController {
8484
}
8585
```
8686

87-
{% include code-caption.html content="test/unit/controllers/ping.controller.unit.ts" %}
87+
{% include code-caption.html content="src/__tests__/unit/controllers/ping.controller.unit.ts" %}
8888

8989
```ts
9090
import {PingController} from '../../..';
@@ -145,7 +145,7 @@ export function getTestMetadata(
145145
}
146146
```
147147

148-
{% include code-caption.html content="test/unit/decorators/test.decorator.unit.ts" %}
148+
{% include code-caption.html content="src/__tests__/unit/decorators/test.decorator.unit.ts" %}
149149

150150
```ts
151151
import {test, getTestMetadata} from '../../..';
@@ -194,7 +194,7 @@ export class RandomNumberProvider implements Provider<number> {
194194
}
195195
```
196196

197-
{% include code-caption.html content="test/unit/providers/random-number.provider.unit.ts" %}
197+
{% include code-caption.html content="src/__tests__/unit/providers/random-number.provider.unit.ts" %}
198198

199199
```ts
200200
import {RandomNumberProvider} from '../../..';
@@ -255,7 +255,7 @@ export function TimeMixin<T extends Constructor<any>>(superClass: T) {
255255
}
256256
```
257257

258-
{% include code-caption.html content="test/integration/mixins/time.mixin.integration.ts" %}
258+
{% include code-caption.html content="src/__tests__/integration/mixins/time.mixin.integration.ts" %}
259259

260260
```ts
261261
import {expect} from '@loopback/testlab';
@@ -302,4 +302,4 @@ Have a look at
302302
[loopback4-example-log-extension](https://github.com/strongloop/loopback-next/tree/master/examples/log-extension)
303303
to understand the extension artifacts and their usage. An Acceptance test can be
304304
seen here:
305-
[test/acceptance/log.extension.acceptance.ts](https://github.com/strongloop/loopback-next/blob/master/examples/log-extension/test/acceptance/log.extension.acceptance.ts).
305+
[src/**tests**/acceptance/log.extension.acceptance.ts](https://github.com/strongloop/loopback-next/blob/master/examples/log-extension/src/__tests__/acceptance/log.extension.acceptance.ts).

docs/site/Testing-your-application.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ database is not something we want to clean before each test it's handy to use an
103103
independent in-memory datasource which is filled appropriately using
104104
[test data builders](#use-test-data-builders) before each test run.
105105

106-
{% include code-caption.html content="test/fixtures/datasources/testdb.datasource.ts" %}
106+
{% include code-caption.html content="src/__tests__/fixtures/datasources/testdb.datasource.ts" %}
107107

108108
```ts
109109
import {juggler} from '@loopback/repository';
@@ -126,7 +126,7 @@ database in the state that caused the test to fail.
126126
To clean the database before each test, set up a `beforeEach` hook to call a
127127
helper method; for example:
128128

129-
{% include code-caption.html content="test/helpers/database.helpers.ts" %}
129+
{% include code-caption.html content="src/__tests__/helpers/database.helpers.ts" %}
130130

131131
```ts
132132
import {ProductRepository, CategoryRepository} from '../../src/repositories';
@@ -141,7 +141,7 @@ export async function givenEmptyDatabase() {
141141
In case a repository includes a relation to another repository, ie. Product
142142
belongs to Category, include it in the repository call, for example:
143143

144-
{% include code-caption.html content="test/helpers/database.helpers.ts" %}
144+
{% include code-caption.html content="src/__tests__/helpers/database.helpers.ts" %}
145145

146146
```ts
147147
import {Getter} from '@loopback/context';
@@ -160,7 +160,7 @@ export async function givenEmptyDatabase() {
160160
}
161161
```
162162

163-
{% include code-caption.html content="test/integration/controllers/product.controller.integration.ts" %}
163+
{% include code-caption.html content="src/__tests__/integration/controllers/product.controller.integration.ts" %}
164164

165165
```ts
166166
// in your test file
@@ -198,7 +198,7 @@ documents.
198198
In practice, a simple function that adds missing required properties is
199199
sufficient.
200200

201-
{% include code-caption.html content="test/helpers/database.helpers.ts" %}
201+
{% include code-caption.html content="src/__tests__/helpers/database.helpers.ts" %}
202202

203203
```ts
204204
// ...
@@ -432,7 +432,7 @@ implementation of its repository dependency using the `testlab`
432432
[Create a stub repository](#create-a-stub-repository) for a detailed
433433
explanation.
434434

435-
{% include code-caption.html content="test/unit/controllers/product.controller.unit.ts" %}
435+
{% include code-caption.html content="src/__tests__/unit/controllers/product.controller.unit.ts" %}
436436

437437
```ts
438438
import {
@@ -482,7 +482,7 @@ unit tests to verify the implementation of this additional method.
482482
Remember to use [Test data builders](#use-test-data-builders) whenever you need
483483
valid data to create a new model instance.
484484

485-
{% include code-caption.html content="test/unit/models/person.model.unit.ts" %}
485+
{% include code-caption.html content="src/__tests__/unit/models/person.model.unit.ts" %}
486486

487487
```ts
488488
import {Person} from '../../../src/models';
@@ -569,7 +569,7 @@ Integration tests are one of the places to put the best practices in
569569
Here is an example showing how to write an integration test for a custom
570570
repository method `findByName`:
571571

572-
{% include code-caption.html content="test/integration/repositories/category.repository.integration.ts" %}
572+
{% include code-caption.html content="src/__tests__/integration/repositories/category.repository.integration.ts" %}
573573

574574
```ts
575575
import {
@@ -604,7 +604,7 @@ commands and queries produce expected results when executed on a real database.
604604
These tests are similar to repository tests with controllers added as another
605605
ingredient.
606606

607-
{% include code-caption.html content="test/integration/controllers/product.controller.integration.ts" %}
607+
{% include code-caption.html content="src/__tests__/integration/controllers/product.controller.integration.ts" %}
608608

609609
```ts
610610
import {expect} from '@loopback/testlab';
@@ -742,10 +742,9 @@ provides a helper method `validateApiSpec` that builds on top of the popular
742742

743743
Example usage:
744744

745-
{% include code-caption.html content= "test/acceptance/api-spec.acceptance.ts" %}
745+
{% include code-caption.html content= "src/__tests__/acceptance/api-spec.acceptance.ts" %}
746746

747747
```ts
748-
// test/acceptance/api-spec.test.ts
749748
import {HelloWorldApplication} from '../..';
750749
import {RestServer} from '@loopback/rest';
751750
import {validateApiSpec} from '@loopback/testlab';
@@ -785,7 +784,7 @@ developers consuming your API will find them useful too.
785784

786785
Here is an example showing how to run Dredd to test your API against the spec:
787786

788-
{% include code-caption.html content= "test/acceptance/api-spec.acceptance.ts" %}
787+
{% include code-caption.html content= "src/__tests__/acceptance/api-spec.acceptance.ts" %}
789788

790789
```ts
791790
import {expect} from '@loopback/testlab';
@@ -857,7 +856,7 @@ two tests (one test for each user role).
857856

858857
Here is an example of an acceptance test:
859858

860-
{% include code-caption.html content= "test/acceptance/product.acceptance.ts" %}
859+
{% include code-caption.html content= "src/__tests__/acceptance/product.acceptance.ts" %}
861860

862861
```ts
863862
import {HelloWorldApplication} from '../..';

0 commit comments

Comments
 (0)