Skip to content

Commit

Permalink
Added unit testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
kdivya153 committed Nov 21, 2024
1 parent 3f55310 commit 983c701
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const CONSTANTS = {
METHODS_TO_BE_EXCLUDED_ONLY_DEVICES: [],
PUBSUB_ACK: { pubSubStatus: 'Connection successful' },
SUBSCRIBE: 'Subscribe',
ADDITIONAL_SUBSCRIBE: 'Subscribing additional methods',
ADDITIONAL_SUBSCRIBE: 'Subscribing additional method',
PROVIDER_REGISTRATION: 'provider registered successfully',
PROVIDER_REGISTRATION_FAILED: 'Provider registeration failed',
NO_PROVIDER_SPECIFIED: 'No provider has been specified',
Expand Down
9 changes: 8 additions & 1 deletion test/unit/MethodFilters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,23 @@ describe('MethodFilters', () => {

describe('isSubscribeMethod', () => {
test('should return true if method has Subscribe in it', () => {
method = { name: 'Subscribe device.id' };
method = { name: 'Subscribing additional method device.id' };
result = methodFilters.isSubscribeMethod(method);
expect(result).toBe(true);
});

test('should return false if method does not have subscribe in it ', () => {
method = { name: 'account.id' };
result = methodFilters.isSubscribeMethod(method);
expect(result).toBe(false);
});

test('should return false if method does not have subscribe in it ', () => {
method = { name: 'Subscribe to settings' };
result = methodFilters.isSubscribeMethod(method);
expect(result).toBe(false);
});

test('should return false if method has Subscribe but not in the beginning ', () => {
method = { name: 'account.id Subscribe' };
result = methodFilters.isSubscribeMethod(method);
Expand Down

0 comments on commit 983c701

Please sign in to comment.