Skip to content

Commit cdb502c

Browse files
committed
Fixed up tests
1 parent 79ea2d0 commit cdb502c

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

packages/auth/src/api/index.test.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,26 @@ describe('api/_performApiRequest', () => {
7474
});
7575
afterEach(mockFetch.tearDown);
7676

77-
it.only('should set the correct request, method and HTTP Headers', async () => {
77+
it('should set the correct request, method and HTTP Headers', async () => {
78+
const mock = mockEndpoint(Endpoint.SIGN_UP, serverResponse);
79+
const response = await _performApiRequest<
80+
typeof request,
81+
typeof serverResponse
82+
>(auth, HttpMethod.POST, Endpoint.SIGN_UP, request);
83+
expect(response).to.eql(serverResponse);
84+
expect(mock.calls.length).to.eq(1);
85+
expect(mock.calls[0].method).to.eq(HttpMethod.POST);
86+
expect(mock.calls[0].request).to.eql(request);
87+
expect(mock.calls[0].headers!.get(HttpHeader.CONTENT_TYPE)).to.eq(
88+
'application/json'
89+
);
90+
expect(mock.calls[0].headers!.get(HttpHeader.X_CLIENT_VERSION)).to.eq(
91+
'testSDK/0.0.0'
92+
);
93+
expect(mock.calls[0].fullRequest?.credentials).to.be.undefined;
94+
});
95+
96+
it('should set credentials to "include" when using IDX and emulator', async () => {
7897
const mock = mockEndpoint(Endpoint.SIGN_UP, serverResponse);
7998
auth.emulatorConfig = {
8099
host: 'https://something.cloudworkstations.dev',
@@ -84,7 +103,7 @@ describe('api/_performApiRequest', () => {
84103
disableWarnings: false
85104
}
86105
};
87-
const response = await _performApiRequest<
106+
await _performApiRequest<
88107
typeof request,
89108
typeof serverResponse
90109
>(auth, HttpMethod.POST, Endpoint.SIGN_UP, request);

packages/auth/src/core/auth/emulator.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ describe.only('core/auth/emulator', () => {
184184
);
185185
});
186186

187-
it('skips console info and has no banner if warnings disabled', () => {
187+
it.only('skips console info and has no banner if warnings disabled', () => {
188188
sinon.stub(console, 'info');
189189
connectAuthEmulator(auth, 'http://127.0.0.1:2020', {
190190
disableWarnings: true

0 commit comments

Comments
 (0)