From ea1a9a7c1d567ad78c0e61b755c5a23dcb0fcb5d Mon Sep 17 00:00:00 2001 From: watanabeyu Date: Thu, 9 May 2019 18:38:37 +0900 Subject: [PATCH] check more pattern --- __tests__/index.ts | 47 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/__tests__/index.ts b/__tests__/index.ts index 689e6d9..e603187 100644 --- a/__tests__/index.ts +++ b/__tests__/index.ts @@ -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 () => { @@ -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'); }); });