New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

classy-test

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

classy-test - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

package.json
{
"name": "classy-test",
"version": "1.0.1",
"version": "1.0.2",
"description": "Opinionated class based testing framework",

@@ -28,3 +28,3 @@ "main": "index.js",

"bin": {
"classy-test": "classy-test-cli.js"
"classy-test": "./bin/classy-test-cli.js"
},

@@ -31,0 +31,0 @@ "directories": {

@@ -50,4 +50,61 @@ # Classy Test

For examples check [here](examples).
### Component
my-project/lib/component.js
```js
"use strict";
class SimpleComponent {
constructor(numbers) {
this.numbers = numbers;
}
sum() {
return this.numbers.reduce((a, b) => a + b);
}
sort() {
return this.numbers.sort();
}
}
module.exports = SimpleComponent;
```
### Test File
my-project/test/component.test.js
```js
"use strict";
const Component = require("./component"),
classyTest = require("classy-test"),
assert = require("chai").assert;
// extend base test case.
class ComponentTestCase extends classyTest.BaseTestCase {
constructor() {
super();
}
// prefix all test functions in your test case with 'test'
testSum() {
assert.equal(new Component([1, 2, 3, 4]).sum(), 10);
}
testSort() {
assert.deepEqual(new Component([4, 1, 5, 2, 3]).sort(), [1, 2, 3, 4, 5]);
}
}
// export an array of test cases you want to run
module.exports = [
Component
];
```
For more examples check [here](examples).
## Team

@@ -54,0 +111,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc