Skip to content

Commit 327cb5c

Browse files
committed
Rename files and remove browser environment check
1 parent 3b9f149 commit 327cb5c

File tree

7 files changed

+63
-136
lines changed

7 files changed

+63
-136
lines changed

lib/node_modules/@stdlib/datasets/month-names-en/benchmark/benchmark.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@
33
// MODULES //
44

55
var bench = require( '@stdlib/bench' );
6+
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
67
var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
78
var pkg = require( './../package.json' ).name;
89
var months = require( './../lib' );
910

1011

12+
// VARIABLES //
13+
14+
var opts = {
15+
'skip': IS_BROWSER
16+
};
17+
18+
1119
// MAIN //
1220

13-
bench( pkg, function benchmark( b ) {
21+
bench( pkg, opts, function benchmark( b ) {
1422
var data;
1523
var i;
1624
b.tic();

lib/node_modules/@stdlib/datasets/month-names-en/benchmark/benchmark.non_browser.js

-29
This file was deleted.

lib/node_modules/@stdlib/datasets/month-names-en/lib/index.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,7 @@
1414

1515
// MODULES //
1616

17-
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
18-
19-
20-
// MAIN //
21-
22-
var months;
23-
if ( IS_BROWSER ) {
24-
months = require( './browser.js' );
25-
} else {
26-
months = require( './month_names_en.js' );
27-
}
17+
var months = require( './main.js' );
2818

2919

3020
// EXPORTS //
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
'use strict';
2+
3+
// MODULES //
4+
5+
var tape = require( 'tape' );
6+
var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
7+
var months = require( './../lib/browser.js' );
8+
9+
10+
// TESTS //
11+
12+
tape( 'main export is a function', function test( t ) {
13+
t.ok( true, __filename );
14+
t.equal( typeof months, 'function', 'main export is a function' );
15+
t.end();
16+
});
17+
18+
tape( 'the function returns an array of string primitives', function test( t ) {
19+
var list = months();
20+
t.equal( isStringArray( list ), true, 'returns an array of string primitives' );
21+
t.equal( list.length, 12, 'has length of 12' );
22+
t.end();
23+
});
24+
25+
tape( 'the function returns a copy', function test( t ) {
26+
var l1;
27+
var l2;
28+
29+
l1 = months();
30+
l2 = months();
31+
32+
t.notEqual( l1, l2, 'different references' );
33+
34+
l1[ 5 ] = 'beep';
35+
36+
t.equal( l1[ 5 ], 'beep', 'expected element' );
37+
t.notEqual( l1[ 5 ], l2[ 5 ], 'no shared state' );
38+
t.equal( l2[ 5 ], 'June', 'expected element' );
39+
40+
t.end();
41+
});

lib/node_modules/@stdlib/datasets/month-names-en/test/test.js

+10-93
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
// MODULES //
44

55
var tape = require( 'tape' );
6-
var proxyquire = require( 'proxyquire' );
6+
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
77
var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives;
88
var months = require( './../lib' );
99

1010

11+
// VARIABLES //
12+
13+
var opts = {
14+
'skip': IS_BROWSER
15+
};
16+
17+
1118
// TESTS //
1219

1320
tape( 'main export is a function', function test( t ) {
@@ -16,58 +23,14 @@ tape( 'main export is a function', function test( t ) {
1623
t.end();
1724
});
1825

19-
tape( 'main export is a function (browser)', function test( t ) {
20-
var months = proxyquire( './../lib', {
21-
'@stdlib/assert/is-browser': true
22-
});
23-
t.equal( typeof months, 'function', 'main export is a function' );
24-
t.end();
25-
});
26-
27-
tape( 'main export is a function (non-browser)', function test( t ) {
28-
var months = proxyquire( './../lib', {
29-
'@stdlib/assert/is-browser': false
30-
});
31-
t.equal( typeof months, 'function', 'main export is a function' );
32-
t.end();
33-
});
34-
35-
tape( 'the function returns an array of string primitives', function test( t ) {
26+
tape( 'the function returns an array of string primitives', opts, function test( t ) {
3627
var list = months();
3728
t.equal( isStringArray( list ), true, 'returns an array of string primitives' );
3829
t.equal( list.length, 12, 'has length of 12' );
3930
t.end();
4031
});
4132

42-
tape( 'the function returns an array of string primitives (browser)', function test( t ) {
43-
var months;
44-
var list;
45-
46-
months = proxyquire( './../lib', {
47-
'@stdlib/assert/is-browser': true
48-
});
49-
50-
list = months();
51-
t.equal( isStringArray( list ), true, 'returns an array of string primitives' );
52-
t.equal( list.length, 12, 'has length of 12' );
53-
t.end();
54-
});
55-
56-
tape( 'the function returns an array of string primitives (non-browser)', function test( t ) {
57-
var months;
58-
var list;
59-
60-
months = proxyquire( './../lib', {
61-
'@stdlib/assert/is-browser': false
62-
});
63-
64-
list = months();
65-
t.equal( isStringArray( list ), true, 'returns an array of string primitives' );
66-
t.equal( list.length, 12, 'has length of 12' );
67-
t.end();
68-
});
69-
70-
tape( 'the function returns a copy', function test( t ) {
33+
tape( 'the function returns a copy', opts, function test( t ) {
7134
var l1;
7235
var l2;
7336

@@ -84,49 +47,3 @@ tape( 'the function returns a copy', function test( t ) {
8447

8548
t.end();
8649
});
87-
88-
tape( 'the function returns a copy (browser)', function test( t ) {
89-
var months;
90-
var l1;
91-
var l2;
92-
93-
months = proxyquire( './../lib', {
94-
'@stdlib/assert/is-browser': true
95-
});
96-
97-
l1 = months();
98-
l2 = months();
99-
100-
t.notEqual( l1, l2, 'different references' );
101-
102-
l1[ 5 ] = 'beep';
103-
104-
t.equal( l1[ 5 ], 'beep', 'expected element' );
105-
t.notEqual( l1[ 5 ], l2[ 5 ], 'no shared state' );
106-
t.equal( l2[ 5 ], 'June', 'expected element' );
107-
108-
t.end();
109-
});
110-
111-
tape( 'the function returns a copy (non-browser)', function test( t ) {
112-
var months;
113-
var l1;
114-
var l2;
115-
116-
months = proxyquire( './../lib', {
117-
'@stdlib/assert/is-browser': false
118-
});
119-
120-
l1 = months();
121-
l2 = months();
122-
123-
t.notEqual( l1, l2, 'different references' );
124-
125-
l1[ 5 ] = 'beep';
126-
127-
t.equal( l1[ 5 ], 'beep', 'expected element' );
128-
t.notEqual( l1[ 5 ], l2[ 5 ], 'no shared state' );
129-
t.equal( l2[ 5 ], 'June', 'expected element' );
130-
131-
t.end();
132-
});

lib/node_modules/@stdlib/datasets/month-names-en/test/test.month_names_en.js renamed to lib/node_modules/@stdlib/datasets/month-names-en/test/test.main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
var tape = require( 'tape' );
66
var proxyquire = require( 'proxyquire' );
7-
var months = require( './../lib/month_names_en.js' );
7+
var months = require( './../lib/main.js' );
88

99

1010
// TESTS //
@@ -16,7 +16,7 @@ tape( 'main export is a function', function test( t ) {
1616
});
1717

1818
tape( 'the function throws an error if unable to load data', function test( t ) {
19-
var months = proxyquire( './../lib/month_names_en.js', {
19+
var months = proxyquire( './../lib/main.js', {
2020
'@stdlib/fs/read-json': {
2121
'sync': readJSON
2222
}

0 commit comments

Comments
 (0)