UNPKG

1.74 kBJavaScriptView Raw
1/**
2 * Module dependencies
3 */
4var util = require( './util' );
5var assert = require( 'assert' );
6
7/**
8 * Testing data
9 */
10var fixture = require( './fixture' );
11
12describe( 'wpcom.domains', function() {
13 // Global instances
14 const wpcom = util.wpcom();
15 const domains = wpcom.domains();
16
17 describe( 'wpcom.domains.suggestions', function() {
18 it( 'should request domains passing a string as query', done => {
19 domains.suggestions( fixture.queryDomains.query )
20 .then( data => {
21 assert.ok( data );
22 assert.equal( 'number', typeof data.length );
23
24 done();
25 } )
26 .catch( done );
27 } );
28
29 it( 'should request domains passing an object as query', done => {
30 domains.suggestions( fixture.queryDomains )
31 .then( data => {
32 assert.ok( data );
33 assert.equal( 'number', typeof data.length );
34
35 done();
36 } )
37 .catch( done );
38 } );
39 } );
40
41 describe( 'wpcom.domains.suggestionsExamples', function() {
42 it( 'should request domains using the example endpoint', done => {
43 domains.suggestions( fixture.queryDomains.query )
44 .then( data => {
45 assert.ok( data );
46 assert.equal( 'number', typeof data.length );
47 done();
48 } )
49 .catch( done );
50 } );
51 } );
52
53 describe( 'wpcom.domains.supportedStates', function() {
54 it( 'should get localized list of supported states of Spain', done => {
55 domains.supportedStates( 'es' )
56 .then( data => {
57 assert.ok( data );
58 done();
59 } )
60 .catch( done );
61 } );
62 } );
63
64 describe( 'wpcom.domains.supportedCountries', function() {
65 it( 'should get localized list of supported countries', done => {
66 domains.supportedCountries()
67 .then( data => {
68 assert.ok( data );
69 done();
70 } )
71 .catch( done );
72 } );
73 } );
74} );