Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha #119

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Alpha #119

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yandex-cloud/nodejs-sdk",
"version": "2.4.2",
"version": "3.0.0-alpha.1",
"description": "Yandex.Cloud NodeJS SDK",
"keywords": [
"yandex-cloud",
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from './session';
export * from './utils/operation';
export * from './utils/decode-message';
export { WrappedServiceClientType } from './types';
export * from './service-endpoints';
10 changes: 6 additions & 4 deletions src/service-endpoints.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { getServiceClientEndpoint } from './service-endpoints';
import { ServiceEndpointResolver } from './service-endpoints';
import { serviceClients } from '.';
import { GeneratedServiceClientCtor } from './types';

// eslint-disable-next-line @typescript-eslint/ban-types
type MockServiceClientCtor = GeneratedServiceClientCtor<{}>;

const serviceEndpointResolver = new ServiceEndpointResolver();

describe('service endpoints', () => {
it('each service in generated service_clients module should have endpoint declared in service-endpoints', () => {
for (const [, ServiceClient] of Object.entries(serviceClients)) {
// eslint-disable-next-line @typescript-eslint/no-loop-func
expect(() => {
const endpoint = getServiceClientEndpoint(ServiceClient as MockServiceClientCtor);
const endpoint = serviceEndpointResolver.resolve(ServiceClient as MockServiceClientCtor);

expect(endpoint).toBeTruthy();
}).not.toThrow();
Expand All @@ -21,13 +23,13 @@ describe('service endpoints', () => {
const serviceName = 'myCustomService';

expect(() => {
getServiceClientEndpoint({ serviceName } as unknown as MockServiceClientCtor);
serviceEndpointResolver.resolve({ serviceName } as unknown as MockServiceClientCtor);
}).toThrow(`Endpoint for service ${serviceName} is no defined`);
});

it('should throw exception if client class has no serviceName option', () => {
expect(() => {
getServiceClientEndpoint({} as unknown as MockServiceClientCtor);
serviceEndpointResolver.resolve({} as unknown as MockServiceClientCtor);
}).toThrow('Unable to retrieve serviceName of provided service client class');
});
});
Loading