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 5, 2023
1 parent 552641a commit bc573ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 46 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
[npm-image]: http://img.shields.io/npm/v/@stdlib/utils-define-property.svg
[npm-url]: https://npmjs.org/package/@stdlib/utils-define-property

[test-image]: https://github.com/stdlib-js/utils-define-property/actions/workflows/test.yml/badge.svg?branch=v0.1.1
[test-url]: https://github.com/stdlib-js/utils-define-property/actions/workflows/test.yml?query=branch:v0.1.1
[test-image]: https://github.com/stdlib-js/utils-define-property/actions/workflows/test.yml/badge.svg?branch=main
[test-url]: https://github.com/stdlib-js/utils-define-property/actions/workflows/test.yml?query=branch:main

[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/utils-define-property/main.svg
[coverage-url]: https://codecov.io/github/stdlib-js/utils-define-property?branch=main
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"@stdlib/types": "^0.1.0"
},
"devDependencies": {
"@stdlib/assert-has-own-property": "^0.1.0",
"@stdlib/assert-is-string": "^0.1.0",
"@stdlib/assert-has-own-property": "^0.1.1",
"@stdlib/assert-is-string": "^0.1.1",
"@stdlib/bench": "^0.1.0",
"@stdlib/math-base-special-sqrt": "^0.1.0",
"@stdlib/string-from-code-point": "^0.1.0",
Expand Down
46 changes: 4 additions & 42 deletions test/dist/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
* Copyright (c) 2023 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,51 +21,13 @@
// MODULES //

var tape = require( 'tape' );
var proxyquire = require( 'proxyquire' );
var polyfill = require( './../../dist/polyfill.js' );
var builtin = require( './../../dist/builtin.js' );
var defineProperty = 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 defineProperty, 'function', 'main export is a function' );
t.end();
});

tape( 'if an environment supports `Object.defineProperty`, the exported value is the built-in value', function test( t ) {
var defineProperty = proxyquire( './../dist', {
'./has_define_property_support.js': mock
});

t.equal( defineProperty, builtin, 'exports built-in' );
t.end();

function mock() {
return true;
}
});

tape( 'if an environment does not support `Object.defineProperty`, the exported value is a polyfill', function test( t ) {
var defineProperty = proxyquire( './../dist', {
'./has_define_property_support.js': mock
});

t.equal( defineProperty, polyfill, 'exports polyfill' );
t.end();

function mock() {
return false;
}
});

tape( 'the function sets a property on a provided object', function test( t ) {
var obj = {};
defineProperty( obj, 'foo', {
'value': 'bar'
});
t.equal( obj.foo, 'bar', 'prop foo equals bar' );
t.strictEqual( main !== void 0, true, 'main export is defined' );
t.end();
});

0 comments on commit bc573ba

Please sign in to comment.