Skip to content

Commit 177a276

Browse files
committed
ref: Add tests
1 parent e812154 commit 177a276

File tree

2 files changed

+27
-43
lines changed

2 files changed

+27
-43
lines changed

packages/hub/test/hub.test.ts

+26-9
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,32 @@ describe('Hub', () => {
5151
expect(hub.getStack()[1].client).toBe(testClient);
5252
});
5353

54-
test('bindClient', () => {
55-
const testClient: any = { bla: 'a' };
56-
const hub = new Hub(testClient);
57-
const ndClient: any = { foo: 'bar' };
58-
hub.pushScope();
59-
hub.bindClient(ndClient);
60-
expect(hub.getStack()).toHaveLength(2);
61-
expect(hub.getStack()[0].client).toBe(testClient);
62-
expect(hub.getStack()[1].client).toBe(ndClient);
54+
describe('bindClient', () => {
55+
test('simple', () => {
56+
const testClient: any = { bla: 'a' };
57+
const hub = new Hub(testClient);
58+
const ndClient: any = { foo: 'bar' };
59+
hub.pushScope();
60+
hub.bindClient(ndClient);
61+
expect(hub.getStack()).toHaveLength(2);
62+
expect(hub.getStack()[0].client).toBe(testClient);
63+
expect(hub.getStack()[1].client).toBe(ndClient);
64+
});
65+
test('call setupIntegrations', () => {
66+
const setupIntegrations = jest.fn();
67+
const testClient: any = { setupIntegrations };
68+
const hub = new Hub(testClient);
69+
hub.bindClient(testClient);
70+
expect(setupIntegrations).toHaveBeenCalled();
71+
});
72+
73+
test('call setupIntegrations from constructor', () => {
74+
const setupIntegrations = jest.fn();
75+
const testClient: any = { setupIntegrations };
76+
const hub = new Hub(testClient);
77+
expect(setupIntegrations).toHaveBeenCalled();
78+
expect(hub).toBeTruthy();
79+
});
6380
});
6481

6582
test('inherit processors', () => {

yarn.lock

+1-34
Original file line numberDiff line numberDiff line change
@@ -1810,32 +1810,11 @@ after@0.8.2:
18101810
version "0.8.2"
18111811
resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f"
18121812

1813-
agent-base@4, agent-base@^4.3.0:
1814-
version "4.3.0"
1815-
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
1816-
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
1817-
dependencies:
1818-
es6-promisify "^5.0.0"
1819-
1820-
agent-base@5:
1813+
agent-base@4, agent-base@5, agent-base@6, agent-base@^4.3.0, agent-base@~4.2.0:
18211814
version "5.1.1"
18221815
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c"
18231816
integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==
18241817

1825-
agent-base@6:
1826-
version "6.0.0"
1827-
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.0.tgz#5d0101f19bbfaed39980b22ae866de153b93f09a"
1828-
integrity sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==
1829-
dependencies:
1830-
debug "4"
1831-
1832-
agent-base@~4.2.0:
1833-
version "4.2.1"
1834-
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
1835-
integrity sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==
1836-
dependencies:
1837-
es6-promisify "^5.0.0"
1838-
18391818
agentkeepalive@^3.4.1:
18401819
version "3.5.2"
18411820
resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-3.5.2.tgz#a113924dd3fa24a0bc3b78108c450c2abee00f67"
@@ -4553,18 +4532,6 @@ es-to-primitive@^1.1.1, es-to-primitive@^1.2.0:
45534532
is-date-object "^1.0.1"
45544533
is-symbol "^1.0.2"
45554534

4556-
es6-promise@^4.0.3:
4557-
version "4.2.8"
4558-
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
4559-
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==
4560-
4561-
es6-promisify@^5.0.0:
4562-
version "5.0.0"
4563-
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
4564-
integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=
4565-
dependencies:
4566-
es6-promise "^4.0.3"
4567-
45684535
escape-html@~1.0.3:
45694536
version "1.0.3"
45704537
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"

0 commit comments

Comments
 (0)