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

fix: respect . in api versions (fix adsense API) #1573

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/apis/adsense/index.ts
Expand Up @@ -20,10 +20,10 @@ export const VERSIONS = {
'v1.4': adsense_v1_4.Adsense,
};

export function adsense(version: 'v1_4'): adsense_v1_4.Adsense;
JustinBeckwith marked this conversation as resolved.
Show resolved Hide resolved
export function adsense(version: 'v1.4'): adsense_v1_4.Adsense;
export function adsense(options: adsense_v1_4.Options): adsense_v1_4.Adsense;
export function adsense<T = adsense_v1_4.Adsense>(
this: GoogleConfigurable, versionOrOptions: 'v1_4'|adsense_v1_4.Options) {
this: GoogleConfigurable, versionOrOptions: 'v1.4'|adsense_v1_4.Options) {
return getAPI<T>('adsense', versionOrOptions, VERSIONS, this);
}

Expand Down
47 changes: 47 additions & 0 deletions test/test.adsense.ts
@@ -0,0 +1,47 @@
// Copyright 2019 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import * as assert from 'assert';
import {adsense_v1_4, GoogleApis} from '../src';
import {Utils} from './utils';

const googleapis = new GoogleApis();

describe('adsense:1.4', () => {
let localAdsense: adsense_v1_4.Adsense, remoteAdsense: adsense_v1_4.Adsense;

before(async () => {
remoteAdsense = await Utils.loadApi<adsense_v1_4.Adsense>(googleapis, 'adsense', 'v1.4');
});

beforeEach(() => {
localAdsense = googleapis.adsense('v1.4');
JustinBeckwith marked this conversation as resolved.
Show resolved Hide resolved
})

it('should exist', (done) => {
assert.notEqual(typeof googleapis.adsense, null);
done();
});

it('should be a function', (done) => {
assert.strictEqual(typeof googleapis.adsense, 'function');
done();
});

it('should create an adsence object on default', (done) => {
assert.notEqual(typeof localAdsense, 'undefined');
assert.notEqual(typeof remoteAdsense, 'undefined');
done();
});
})