Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Oct 18, 2023
1 parent 6db2883 commit 6ba91b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 198 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ jobs:
fi
# Trim leading and trailing whitespace:
dep=$(echo "$dep" | xargs)
version="^$(npm view $dep version)"
version="$(npm view $dep version)"
if [[ -z "$version" ]]; then
continue
fi
version="^$version"
jq -r --arg dep "$dep" --arg version "$version" '.dependencies[$dep] = $version' package.json > package.json.tmp
mv package.json.tmp package.json
done
Expand All @@ -192,7 +196,11 @@ jobs:
fi
# Trim leading and trailing whitespace:
dep=$(echo "$dep" | xargs)
version="^$(npm view $dep version)"
version="$(npm view $dep version)"
if [[ -z "$version" ]]; then
continue
fi
version="^$version"
jq -r --arg dep "$dep" --arg version "$version" '.devDependencies[$dep] = $version' package.json > package.json.tmp
mv package.json.tmp package.json
done
Expand Down
199 changes: 3 additions & 196 deletions test/dist/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,206 +21,13 @@
// MODULES //

var tape = require( 'tape' );
var dotcase = require( './../../dist' );
var main = require( './../../dist' );


// TESTS //

tape( 'main export is a function', function test( t ) {
tape( 'main export is defined', function test( t ) {
t.ok( true, __filename );
t.strictEqual( typeof dotcase, 'function', 'main export is a function' );
t.end();
});

tape( 'the function throws an error if not provided a string', function test( t ) {
var values;
var i;

values = [
5,
NaN,
null,
void 0,
true,
false,
[],
{},
function noop() {}
];

for ( i = 0; i < values.length; i++ ) {
t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] );
}
t.end();

function badValue( value ) {
return function badValue() {
dotcase( value );
};
}
});

tape( 'the function converts a string to dot case', function test( t ) {
var expected;
var actual;

expected = 'foo.bar';
actual = dotcase( 'foo_bar' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'foo.bar';
actual = dotcase( 'foo-bar' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'foo.bar';
actual = dotcase( 'foo.bar' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'hello.world';
actual = dotcase( 'Hello World!' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'b.eep.b.oop';
actual = dotcase( 'bEep bOOP' );
t.strictEqual( actual, expected, 'returns expected value' );

t.end();
});

tape( 'the function converts a string with Unicode characters to dot case', function test( t ) {
var expected;
var actual;

expected = 'fóo.bar';
actual = dotcase( 'fóo_bar' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'fóo.bar';
actual = dotcase( 'fóo-bar' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'fóo.bar';
actual = dotcase( 'fóoBar' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'héllo.wórld';
actual = dotcase( 'héllo Wórld!' );
t.strictEqual( actual, expected, 'returns expected value' );

t.end();
});

tape( 'the function converts a string in camel case to dot case', function test( t ) {
var expected;
var actual;

expected = 'foo.bar';
actual = dotcase( 'fooBar' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.mostly.some.case';
actual = dotcase( 'isMostlySomeCase' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.mobile';
actual = dotcase( 'isMobile' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.node.repl';
actual = dotcase( 'isNodeRepl' );
t.strictEqual( actual, expected, 'returns expected value' );

t.end();
});

tape( 'the function converts a string in constant case to dot case', function test( t ) {
var expected;
var actual;

expected = 'foo.bar';
actual = dotcase( 'FOO_BAR' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.mostly.constant.case';
actual = dotcase( 'IS_MOSTLY_CONSTANT_CASE' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.mobile';
actual = dotcase( 'IS_MOBILE' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.node.repl';
actual = dotcase( 'IS_NODE_REPL' );
t.strictEqual( actual, expected, 'returns expected value' );

t.end();
});

tape( 'the function converts a string in kebab case to dot case', function test( t ) {
var expected;
var actual;

expected = 'foo.bar';
actual = dotcase( 'foo-bar' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.mostly.some.case';
actual = dotcase( 'is-mostly-some-case' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.mobile';
actual = dotcase( 'is-mobile' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.node.repl';
actual = dotcase( 'is-node-repl' );
t.strictEqual( actual, expected, 'returns expected value' );

t.end();
});

tape( 'the function converts a string in pascal case to dot case', function test( t ) {
var expected;
var actual;

expected = 'foo.bar';
actual = dotcase( 'FooBar' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.mostly.some.case';
actual = dotcase( 'IsMostlySomeCase' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.mobile';
actual = dotcase( 'IsMobile' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.node.repl';
actual = dotcase( 'IsNodeRepl' );
t.strictEqual( actual, expected, 'returns expected value' );

t.end();
});

tape( 'the function leaves a string that is already in dot case unchanged', function test( t ) {
var expected;
var actual;

expected = 'foo.bar';
actual = dotcase( 'foo.bar' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.mostly.some.case';
actual = dotcase( 'is.mostly.some.case' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.mobile';
actual = dotcase( 'is.mobile' );
t.strictEqual( actual, expected, 'returns expected value' );

expected = 'is.node.repl';
actual = dotcase( 'is.node.repl' );
t.strictEqual( actual, expected, 'returns expected value' );

t.strictEqual( main !== void 0, true, 'main export is defined' );
t.end();
});

0 comments on commit 6ba91b9

Please sign in to comment.