UNPKG

re-telefonnummer

Version:

![npm](https://img.shields.io/npm/v/bs-telefonnummer.svg) [![Build Status](https://travis-ci.com/believer/bs-telefonnummer.svg?branch=master)](https://travis-ci.com/believer/bs-telefonnummer) [![Test Coverage](https://api.codeclimate.com/v1/badges/ca9e96b

220 lines (212 loc) 5.62 kB
// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE 'use strict'; var Jest = require("@glennsl/bs-jest/lib/js/src/jest.js"); var Telefonnummer = require("../src/Telefonnummer.bs.js"); Jest.test("phonenumber link", (function (param) { return Jest.Expect.toEqual("tel:0701234567", Jest.Expect.expect(Telefonnummer.Link.make("070-123.45x67"))); })); Jest.testAll("voicemail number", { hd: "888", tl: { hd: "333", tl: { hd: "222", tl: { hd: "147", tl: /* [] */0 } } } }, (function (phoneNumber) { return Jest.Expect.toBe("Röstbrevlåda", Jest.Expect.expect(Telefonnummer.parse(phoneNumber))); })); Jest.testAll("mobile number", { hd: [ "072- 12 34 5 67", "072-123 45 67" ], tl: { hd: [ "0721234567", "072-123 45 67" ], tl: { hd: [ "0701234567", "070-123 45 67" ], tl: { hd: [ "46701234567", "070-123 45 67" ], tl: { hd: [ "+46701234567", "070-123 45 67" ], tl: { hd: [ "0046701234567", "070-123 45 67" ], tl: { hd: [ "+46(0)701234567", "070-123 45 67" ], tl: { hd: [ "+46 0700123456", "070-012 34 56" ], tl: /* [] */0 } } } } } } } }, (function (param) { return Jest.Expect.toBe(param[1], Jest.Expect.expect(Telefonnummer.parse(param[0]))); })); Jest.testAll("landline number", { hd: [ "0 8 1 2 34 56", "08-12 34 56" ], tl: { hd: [ "08123456", "08-12 34 56" ], tl: { hd: [ "4608123456", "08-12 34 56" ], tl: { hd: [ "081234567", "08-123 45 67" ], tl: { hd: [ "46081234567", "08-123 45 67" ], tl: { hd: [ "0812345678", "08-123 456 78" ], tl: { hd: [ "460812345678", "08-123 456 78" ], tl: { hd: [ "03112345", "031-123 45" ], tl: { hd: [ "031123456", "031-12 34 56" ], tl: { hd: [ "004631123456", "031-12 34 56" ], tl: { hd: [ "0311234567", "031-123 45 67" ], tl: { hd: [ "+460311234567", "031-123 45 67" ], tl: { hd: [ "0500123456", "0500-12 34 56" ], tl: { hd: [ "460500123456", "0500-12 34 56" ], tl: { hd: [ "05001234567", "05001234567" ], tl: /* [] */0 } } } } } } } } } } } } } } }, (function (param) { return Jest.Expect.toBe(param[1], Jest.Expect.expect(Telefonnummer.parse(param[0]))); })); Jest.testAll("phone number validation", { hd: [ "072- 12 34 5 67", true ], tl: { hd: [ "0721234567", true ], tl: { hd: [ "08123456", true ], tl: { hd: [ "0500123456", true ], tl: { hd: [ "+460311234567", true ], tl: { hd: [ "05001234567", false ], tl: { hd: [ "a08123456", false ], tl: /* [] */0 } } } } } } }, (function (param) { return Jest.Expect.toBe(param[1], Jest.Expect.expect(Telefonnummer.Validate.isValid(param[0]))); })); /* Not a pure module */