Skip to content

Commit

Permalink
add tet for creating definition
Browse files Browse the repository at this point in the history
Signed-off-by: Dirk Van Haerenborgh <dirk.vanhaerenborgh@aloxy.io>
  • Loading branch information
vhdirk committed Feb 5, 2021
1 parent 87f15a4 commit 8d8835d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 1 addition & 2 deletions javascript/lib/api/src/client/handles/things.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ export class DefaultThingsHandle implements WebSocketThingsHandle, HttpThingsHan
verb: 'POST',
parser: Thing.fromObject,
payload: thingWithoutId
})
;
});
}

public putThing(thing: Thing, options?: MatchOptions): Promise<PutResponse<Thing>> {
Expand Down
14 changes: 13 additions & 1 deletion javascript/lib/api/tests/client/http/things.http.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ describe('Http Things Handle', () => {
});
});

it('updates the definition', () => {
it('creates the definition', () => {
return H.test({
toTest: () => handleV2.putDefinition(H.thing.thingId, 'example:test:definition'),
testBody: 'example:test:definition',
Expand All @@ -290,6 +290,18 @@ describe('Http Things Handle', () => {
});
});

it('updates the definition', () => {
return H.test({
toTest: () => handleV2.putDefinition(H.thing.thingId, 'example:test:definition'),
testBody: 'example:test:definition',
expected: new PutResponse(null, 204, undefined),
request: `${baseRequest}/definition`,
method: 'put',
status: 204,
payload: JSON.stringify('example:test:definition')
});
});

it('deletes a Thing', () => {
return H.test({
toTest: () => handleV2.deleteThing(H.thing.thingId),
Expand Down

0 comments on commit 8d8835d

Please sign in to comment.