Skip to content

Commit

Permalink
fix: keychain tests failing in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
yknl committed Oct 14, 2020
1 parent 0bc9d38 commit 1cfe263
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/keychain/tests/identity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ test('adds to apps in profile if publish_data scope', async () => {
const decoded = decodeToken(authResponse);
const { payload } = decoded as Decoded;
expect(payload.profile.apps['https://banter.pub']).not.toBeFalsy();
// @ts-ignore
const profile = JSON.parse(fetchMock.mock.calls[7][1].body);
const { apps, appsMeta } = profile[0].decodedToken.payload.claim;
expect(apps[appDomain]).not.toBeFalsy();
Expand Down
3 changes: 2 additions & 1 deletion packages/keychain/tests/profile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ describe('registerSubdomain', () => {
expect(fetchMock.mock.calls.length).toEqual(3);
const [registrarUrl, fetchOpts] = fetchMock.mock.calls[2];
expect(registrarUrl).toEqual(registrars[Subdomains.TEST].registerUrl);
expect(fetchOpts.method).toEqual('POST');
expect(fetchOpts!.method).toEqual('POST');
const zoneFile = makeProfileZoneFile('tester.test-personal.id', 'http://gaia.com/profile.json');
// @ts-ignore
expect(JSON.parse(fetchOpts.body)).toEqual({
name: 'tester',
owner_address: identity.address,
Expand Down
3 changes: 3 additions & 0 deletions packages/keychain/tests/wallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ test('creates a config', async () => {
const hubConfig = await wallet.createGaiaConfig('https://gaia.blockstack.org');
const config = await wallet.getOrCreateConfig({ gaiaConfig: hubConfig });
expect(Object.keys(config.identities[0].apps).length).toEqual(0);
// @ts-ignore
const { body } = fetchMock.mock.calls[2][1];
const decrypted = (await decryptContent(body, { privateKey: wallet.configPrivateKey })) as string;
expect(JSON.parse(decrypted)).toEqual(config);
Expand Down Expand Up @@ -195,6 +196,7 @@ test('updates wallet config', async () => {
gaiaConfig,
});
expect(fetchMock.mock.calls.length).toEqual(4);
// @ts-ignore
const body = JSON.parse(fetchMock.mock.calls[3][1].body);
const decrypted = (await decryptContent(JSON.stringify(body), {
privateKey: wallet.configPrivateKey,
Expand Down Expand Up @@ -223,6 +225,7 @@ test('updates config for reusing id warning', async () => {
await wallet.updateConfigForReuseWarning({ gaiaConfig });
expect(wallet.walletConfig?.hideWarningForReusingIdentity).toBeTruthy();
expect(fetchMock.mock.calls.length).toEqual(4);
// @ts-ignore
const body = JSON.parse(fetchMock.mock.calls[3][1].body);
const decrypted = (await decryptContent(JSON.stringify(body), {
privateKey: wallet.configPrivateKey,
Expand Down

0 comments on commit 1cfe263

Please sign in to comment.