ProjectAPI
ProjectAPI is returned by
ctMock.project(projectKey?)
and scopes operations to a single project. In tests you mostly create and read
data through the commercetools API;
ProjectAPI offers a couple of convenience methods for reading state directly.
const api = ctMock.project('my-project')Methods
Section titled “Methods”get(typeId, id, params?)
Section titled “get(typeId, id, params?)”get<RT>(typeId: RT, id: string, params?: GetParams): Promise<ResourceMap[RT]>Fetches a single resource by id, without going through the SDK. params accepts
expand.
const order = await ctMock.project().get('order', orderId, { expand: ['customer'],})getRepository(typeId)
Section titled “getRepository(typeId)”getRepository<RT>(typeId: RT): RepositoryMap[RT]Returns the underlying repository for advanced use. Throws if there is no repository for the type.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
config | Config | The resolved config (strict flag and storage) for this project. |