UNPKG

938 BJavaScriptView Raw
1import test from 'ava'
2import Chance from '../chance.js'
3import _ from 'lodash'
4
5const chance = new Chance()
6
7// chance.android_id()
8test('android_id() returns a proper android id', t => {
9 _.times(1000, () => t.true(/APA91([0-9a-zA-Z-_]){178}/.test(chance.android_id())))
10})
11
12// chance.apple_token()
13test('apple_token() returns a proper apple push token', t => {
14 _.times(1000, () => t.true(/([0-9a-fA-F]){64}/.test(chance.apple_token())))
15})
16
17// chance.wp8_anid2()
18test('wp8_anid2() returns a proper windows phone 8 anid2', t => {
19 _.times(1000, () => t.true(/^([0-9a-zA-Z]){43}=$/.test(chance.wp8_anid2())))
20})
21
22// chance.wp7_anid()
23test('wp7_anid() returns a proper windows phone 7 anid', t => {
24 _.times(1000, () => t.true(/^A=[0-9A-F]{32}&E=[0-9a-f]{3}&W=\d$/.test(chance.wp7_anid())))
25})
26
27test('bb_pin() returns a proper blackberry pin', t => {
28 _.times(1000, () => t.true(/([0-9a-f]){8}/.test(chance.bb_pin())))
29})