Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Added a function reference guide #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,87 @@ new TestDataBuilder()
// context.notification
});
```

## Function reference

LoopBack Testing (lt):
===

* describe,
* it,
* beforeEach,
* TestDataBuilder

lt.describe:
----

* staticMethod,
* instanceMethod,
* whenCalledRemotely,
* whenLoggedInAsUser,
* whenLoggedInAsUserWithRole,
* whenCalledByUser,
* whenCalledByUserWithRole,
* whenCalledAnonymously,
* whenCalledUnauthenticated

lt.it:
----

* shouldBeAllowed,
* shouldBeDenied,
* shouldNotBeFound,
* shouldBeAllowedWhenCalledAnonymously,
* shouldBeDeniedWhenCalledAnonymously,
* shouldBeAllowedWhenCalledUnauthenticated,
* shouldBeDeniedWhenCalledUnauthenticated,
* shouldBeAllowedWhenCalledByUser,
* shouldBeDeniedWhenCalledByUser,
* shouldBeAllowedWhenCalledByUserWithRole,
* shouldBeDeniedWhenCalledByUserWithRole

lt.beforeEach:
----

* withApp,
* withArgs,
* givenModel,
* givenUser,
* givenUserWithRole,
* givenLoggedInUser,
* givenLoggedInUserWithRole,
* givenAnUnauthenticatedToken,
* givenAnAnonymousToken,

lt.TestDataBuilder:
----
Tagline: Build many Model instances in one async call.

* ref (static method)
> Reference the value of a property from a model instance defined before.
>
> @param {string} path - Generally in the form '{name}.{property}', where {name}
is the name passed to `define()` and {property} is the name of
the property to use.

* define (dynamic method)
> Define a new model instance.
>
> @param {string} name Name of the instance.
> `buildTo()` will save the instance created as context[name].
>
> @param {constructor} Model Model class/constructor.
>
> @param {Object.<string, Object>=} properties - Properties to set in the object.
> Intelligent default values are supplied by the builder for required properties not listed.
>
> @return TestDataBuilder (fluent interface)

* buildTo (dynamic method)
> Asynchronously build all models defined via `define()` and save them in the supplied context object.
>
> @param {Object.<string, Object>} context The context to object to populate.
>
> @param {function(Error)} callback Callback.