Skip to content

Commit

Permalink
fix: pass integ tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rishtigupta committed Jun 18, 2024
1 parent 8d42642 commit db61fa0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
1 change: 0 additions & 1 deletion packages/client-sdk-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"integration-test-auth": "jest auth-client.test.ts --maxWorkers 1",
"unit-test": "jest unit",
"integration-test-leaderboard": "jest leaderboard --maxWorkers 1",
"integration-test-store": "jest storage.test.ts --maxWorkers 1",
"integration-test": "jest integration --testPathIgnorePatterns \"auth-client.test.ts|leaderboard.test.ts\" --maxWorkers 1",
"build-deps": "cd ../core && npm run build && cd - && cd ../common-integration-tests && npm run build && cd -",
"build-and-run-tests": "npm run build-deps && jest --testPathIgnorePatterns auth-client.test.ts --maxWorkers 1",
Expand Down
10 changes: 6 additions & 4 deletions packages/client-sdk-nodejs/src/internal/storage-data-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
StoragePut,
StorageDelete,
UnknownError,
SdkError,
} from '@gomomento/sdk-core';
import {validateStoreName} from '@gomomento/sdk-core/dist/src/internal/utils';
import {store} from '@gomomento/generated-types/dist/store';
Expand Down Expand Up @@ -210,7 +211,7 @@ export class StorageDataClient implements IStorageDataClient {
} else {
this.cacheServiceErrorMapper.resolveOrRejectError({
err: err,
errorResponseFactoryFn: e => new StorageGet.Error(e),
errorResponseFactoryFn: (e: SdkError) => new StorageGet.Error(e),
resolveFn: resolve,
rejectFn: reject,
});
Expand All @@ -234,7 +235,7 @@ export class StorageDataClient implements IStorageDataClient {
);
}
this.logger.trace(
`Issuing 'get' request; store: ${storeName}, key: ${key}`
`Issuing 'put' request; store: ${storeName}, key: ${key}`
);
return await this.sendPut(storeName, key, value);
}
Expand Down Expand Up @@ -274,7 +275,7 @@ export class StorageDataClient implements IStorageDataClient {
} else {
this.cacheServiceErrorMapper.resolveOrRejectError({
err: err,
errorResponseFactoryFn: e => new StoragePut.Error(e),
errorResponseFactoryFn: (e: SdkError) => new StoragePut.Error(e),
resolveFn: resolve,
rejectFn: reject,
});
Expand Down Expand Up @@ -323,7 +324,8 @@ export class StorageDataClient implements IStorageDataClient {
} else {
this.cacheServiceErrorMapper.resolveOrRejectError({
err: err,
errorResponseFactoryFn: e => new StorageDelete.Error(e),
errorResponseFactoryFn: (e: SdkError) =>
new StorageDelete.Error(e),
resolveFn: resolve,
rejectFn: reject,
});
Expand Down
1 change: 0 additions & 1 deletion packages/client-sdk-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"prebuild": "eslint . --ext .ts",
"test": "jest --testPathIgnorePatterns auth-client.test.ts --maxWorkers 1",
"unit-test": "jest unit",
"integration-test-store": "jest storage.test.ts --maxWorkers 1",
"integration-test-auth": "jest --env=jsdom auth-client.test.ts --maxWorkers 1",
"integration-test-leaderboard": "jest --env=jsdom leaderboard --maxWorkers 1",
"integration-test-jsdom": "jest integration --env=jsdom --testMatch \"**/dictionary.test.ts|**/ping.test.ts|*/topic-client.test.ts|leaderboard.test.ts\" --maxWorkers 1",
Expand Down
16 changes: 8 additions & 8 deletions packages/client-sdk-web/src/internal/storage-data-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
import {ClientMetadataProvider} from './client-metadata-provider';
import ValueCase = _StoreValue.ValueCase;
import {StorageConfiguration} from '../config/storage-configuration';
import {SdkError} from '@gomomento/sdk-core';

export interface StorageDataClientProps {
configuration: StorageConfiguration;
Expand Down Expand Up @@ -144,7 +145,7 @@ export class StorageDataClient<
} else {
this.cacheServiceErrorMapper.resolveOrRejectError({
err: err,
errorResponseFactoryFn: e => new StorageGet.Error(e),
errorResponseFactoryFn: (e: SdkError) => new StorageGet.Error(e),
resolveFn: resolve,
rejectFn: reject,
});
Expand All @@ -159,7 +160,6 @@ export class StorageDataClient<
key: string,
value: string | number | Uint8Array
): Promise<StoragePut.Response> {
console.log('put called');
try {
validateStoreName(storeName);
} catch (err) {
Expand All @@ -168,13 +168,13 @@ export class StorageDataClient<
err => new StoragePut.Error(err)
);
}
this.logger.trace(`Issuing 'set' request; key: ${key.toString()}`);
this.logger.trace(`Issuing 'put' request; key: ${key.toString()}`);
const result = await this.sendPut(
storeName,
convertToB64String(key),
value
);
this.logger.trace(`'set' request result: ${result.toString()}`);
this.logger.trace(`'put' request result: ${result.toString()}`);
return result;
}

Expand All @@ -183,7 +183,6 @@ export class StorageDataClient<
key: string,
passedInVal: string | number | Uint8Array
): Promise<StoragePut.Response> {
console.log('sendPut called');
console.log(
`storeName: ${storeName} key: ${key} passedInVal: ${
passedInVal as string
Expand All @@ -205,7 +204,7 @@ export class StorageDataClient<
} else {
value.setBytesValue(passedInVal);
}

request.setValue(value);
return await new Promise((resolve, reject) => {
this.clientWrapper.put(
request,
Expand All @@ -217,7 +216,7 @@ export class StorageDataClient<
if (err) {
this.cacheServiceErrorMapper.resolveOrRejectError({
err: err,
errorResponseFactoryFn: e => new StoragePut.Error(e),
errorResponseFactoryFn: (e: SdkError) => new StoragePut.Error(e),
resolveFn: resolve,
rejectFn: reject,
});
Expand Down Expand Up @@ -265,7 +264,8 @@ export class StorageDataClient<
if (err) {
this.cacheServiceErrorMapper.resolveOrRejectError({
err: err,
errorResponseFactoryFn: e => new StorageDelete.Error(e),
errorResponseFactoryFn: (e: SdkError) =>
new StorageDelete.Error(e),
resolveFn: resolve,
rejectFn: reject,
});
Expand Down

0 comments on commit db61fa0

Please sign in to comment.