@engage_so/node
Advanced tools
Comparing version 1.3.4 to 1.4.0
{ | ||
"name": "@engage_so/node", | ||
"version": "1.3.4", | ||
"version": "1.4.0", | ||
"description": "Event driven customer segmentation and targeted engagement.", | ||
@@ -13,3 +13,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@engage_so/core": "^1.3.4" | ||
"@engage_so/core": "^1.4.0" | ||
}, | ||
@@ -21,3 +21,3 @@ "author": "Engage", | ||
}, | ||
"gitHead": "b288998ee988a348358f0a39c3747d1049d37dbd" | ||
"gitHead": "243019a68a3906c5cc2faa5c5227e4d497ee8a50" | ||
} |
const Engage = require('../index') | ||
const id = '1234' | ||
const gid = 'abcd' | ||
@@ -41,4 +42,4 @@ describe('Init', () => { | ||
test('should not throw if no email passed', async () => { | ||
expect(() => { | ||
Engage.identify({ id }) | ||
await expect(() => { | ||
Engage.identify({ id: gid }) | ||
}).not.toThrowError() | ||
@@ -122,1 +123,67 @@ }) | ||
}) | ||
describe('Convert to group', () => { | ||
test('should convert to group', async () => { | ||
await expect(Engage.convertToGroup(gid)).resolves.toMatchObject({ | ||
is_group: true | ||
}) | ||
}) | ||
}) | ||
describe('Convert to user', () => { | ||
test('should convert to user', async () => { | ||
await expect(Engage.convertToUser(gid)).resolves.toMatchObject({ | ||
is_group: false | ||
}) | ||
}) | ||
}) | ||
describe('Add to group', () => { | ||
test('should throw if no group id added', async () => { | ||
await expect(Engage.addToGroup(id)).rejects.toThrowError(/id/) | ||
}) | ||
test('should throw if role and role not string', async () => { | ||
await expect(Engage.addToGroup(id, gid, [ 'something' ])).rejects.toThrowError(/Role/) | ||
}) | ||
test('should pass if group id added', async () => { | ||
await expect(Engage.addToGroup(id, gid)).resolves.toMatchObject({ | ||
groups: [{ | ||
id: gid | ||
}] | ||
}) | ||
}) | ||
}) | ||
describe('Change group role', () => { | ||
test('should throw if no parameters', async () => { | ||
await expect(Engage.changeGroupRole()).rejects.toThrowError(/missing/) | ||
}) | ||
test('should throw if no group id', async () => { | ||
await expect(Engage.changeGroupRole(id)).rejects.toThrowError(/missing/) | ||
}) | ||
test('should throw if no role', async () => { | ||
await expect(Engage.changeGroupRole(id, gid)).rejects.toThrowError(/missing/) | ||
}) | ||
test('should pass if all parameters set', async () => { | ||
await expect(Engage.changeGroupRole(id, gid, 'owner')).resolves.toMatchObject({ | ||
groups: [{ | ||
id: gid, | ||
role: 'owner' | ||
}] | ||
}) | ||
}) | ||
}) | ||
describe('Remove from group', () => { | ||
test('should throw if no parameters', async () => { | ||
await expect(Engage.removeFromGroup()).rejects.toThrowError(/missing/) | ||
}) | ||
test('should throw if no group id', async () => { | ||
await expect(Engage.removeFromGroup(id)).rejects.toThrowError(/missing/) | ||
}) | ||
test('should pass if all parameters set', async () => { | ||
await expect(Engage.removeFromGroup(id, gid)).resolves.toMatchObject({ | ||
groups: [] | ||
}) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6139
181
Updated@engage_so/core@^1.4.0