Skip to content

Commit

Permalink
check more pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
watanabeyu committed May 9, 2019
1 parent 31ba0c7 commit ea1a9a7
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions __tests__/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import fetch from 'jest-fetch-mock';
import checkVersion from '../src';
import checkIOS from '../src/ios';
import checkAndroid from '../src/android';

describe('checkVersion', () => {
beforeEach(() => {
jest.mock('Platform', () => ({
OS: 'android',
}));
jest.mock('Platform', () => ({ OS: 'android' }));
jest.mock('fetch', fetch);
jest.setTimeout(30000);
});

it('error pattern', async () => {
Expand All @@ -19,18 +20,42 @@ describe('checkVersion', () => {
expect(result).toHaveProperty('error', true);
});

it('correct pattern', async () => {
const result = await checkVersion({
version: '1.0.0',
iosStoreURL: 'https://itunes.apple.com/app/id1321198947?mt=8',
androidStoreURL: 'https://play.google.com/store/apps/details?id=jp.ewaf.pinpoint.android',
});
it('ios correct pattern 1', async () => {
const result = await checkIOS(
'1.0.0',
'https://itunes.apple.com/app/id1321198947?mt=8',
);

console.log(result);

expect(result).toHaveProperty('local');
expect(result).toHaveProperty('remote');
expect(result).toHaveProperty('result', 'new');
});

it('ios correct pattern 2', async () => {
const result = await checkIOS(
'1.0.0',
'https://itunes.apple.com/jp/app/pin-point/id1321198947',
);

console.log(result);

expect(result).toHaveProperty('local');
expect(result).toHaveProperty('remote');
expect(result).toHaveProperty('result', 'new');
});

it('android correct pattern', async () => {
const result = await checkAndroid(
'10.0.0',
'https://play.google.com/store/apps/details?id=jp.ewaf.likedsearch.android',
);

console.log(result);

expect(result).toHaveProperty('error', false);
expect(result).toHaveProperty('local');
expect(result).toHaveProperty('remote');
expect(result).toHaveProperty('result');
expect(result).toHaveProperty('result', 'old');
});
});

0 comments on commit ea1a9a7

Please sign in to comment.