summaryrefslogtreecommitdiff
path: root/assertion/features
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2018-12-31 07:44:25 +0100
committerEugen Wissner <belka@caraus.de>2018-12-31 07:44:25 +0100
commit54fcfda40a14b5c3150faff6b2929a31eeea057a (patch)
treeb739da73f9d2ede3e2f959d518de0b2f9babe1c5 /assertion/features
parentc623c4d16f14362cc50418e0f6e5875f785f587e (diff)
downloadcucumber-js-demo-54fcfda40a14b5c3150faff6b2929a31eeea057a.tar.gz
Add node, chai, jest diff comparison
Diffstat (limited to 'assertion/features')
-rw-r--r--assertion/features/chai-variants.feature7
-rw-r--r--assertion/features/failure.feature12
-rw-r--r--assertion/features/steps/chai-expect.js6
-rw-r--r--assertion/features/steps/chai-failure.js10
-rw-r--r--assertion/features/steps/chai-should.js8
-rw-r--r--assertion/features/steps/jest-failure.js10
-rw-r--r--assertion/features/steps/node-failure.js10
-rw-r--r--assertion/features/support/compared.js9
8 files changed, 72 insertions, 0 deletions
diff --git a/assertion/features/chai-variants.feature b/assertion/features/chai-variants.feature
new file mode 100644
index 0000000..0e163cb
--- /dev/null
+++ b/assertion/features/chai-variants.feature
@@ -0,0 +1,7 @@
+Feature: Chai variants
+ Scenario:
+ When I use chai
+ Then I can choose the expect syntax
+
+ When I use chai
+ Then I can choose the should syntax
diff --git a/assertion/features/failure.feature b/assertion/features/failure.feature
new file mode 100644
index 0000000..751fc73
--- /dev/null
+++ b/assertion/features/failure.feature
@@ -0,0 +1,12 @@
+Feature: Failure
+ Scenario:
+ When I use chai
+ Then I see chai diff on failure
+
+ Scenario:
+ When I use jest
+ Then I see jest diff on failure
+
+ Scenario:
+ When I use node
+ Then I see node diff on failure
diff --git a/assertion/features/steps/chai-expect.js b/assertion/features/steps/chai-expect.js
new file mode 100644
index 0000000..44e7c01
--- /dev/null
+++ b/assertion/features/steps/chai-expect.js
@@ -0,0 +1,6 @@
+const { expect } = require('chai')
+const { Then } = require('cucumber')
+
+Then('I can choose the expect syntax', function () {
+ expect(true).to.be.true
+})
diff --git a/assertion/features/steps/chai-failure.js b/assertion/features/steps/chai-failure.js
new file mode 100644
index 0000000..ea3d96e
--- /dev/null
+++ b/assertion/features/steps/chai-failure.js
@@ -0,0 +1,10 @@
+const { expect } = require('chai')
+const { When, Then } = require('cucumber')
+const compared = require('../support/compared')
+
+When('I use chai', function () {
+})
+
+Then('I see chai diff on failure', function () {
+ expect(compared.actual).to.deep.equal(compared.expected)
+})
diff --git a/assertion/features/steps/chai-should.js b/assertion/features/steps/chai-should.js
new file mode 100644
index 0000000..2d733e8
--- /dev/null
+++ b/assertion/features/steps/chai-should.js
@@ -0,0 +1,8 @@
+const { Then } = require('cucumber')
+require('chai').should()
+
+Then('I can choose the should syntax', function () {
+ const boolean = true
+
+ boolean.should.be.true
+})
diff --git a/assertion/features/steps/jest-failure.js b/assertion/features/steps/jest-failure.js
new file mode 100644
index 0000000..e222a7a
--- /dev/null
+++ b/assertion/features/steps/jest-failure.js
@@ -0,0 +1,10 @@
+const expect = require('expect')
+const { When, Then } = require('cucumber')
+const compared = require('../support/compared')
+
+When('I use jest', function () {
+})
+
+Then('I see jest diff on failure', function () {
+ expect(compared.actual).toEqual(compared.expected)
+})
diff --git a/assertion/features/steps/node-failure.js b/assertion/features/steps/node-failure.js
new file mode 100644
index 0000000..7816146
--- /dev/null
+++ b/assertion/features/steps/node-failure.js
@@ -0,0 +1,10 @@
+const assert = require('assert')
+const { When, Then } = require('cucumber')
+const compared = require('../support/compared')
+
+When('I use node', function () {
+})
+
+Then('I see node diff on failure', function () {
+ assert.equal(compared.actual, compared.expected)
+})
diff --git a/assertion/features/support/compared.js b/assertion/features/support/compared.js
new file mode 100644
index 0000000..9c8e70d
--- /dev/null
+++ b/assertion/features/support/compared.js
@@ -0,0 +1,9 @@
+module.exports = {
+ actual: {},
+ expected: [
+ {
+ author: 'Nicolaus Cusanus',
+ title: 'Die belehrte Unwissenheit'
+ }
+ ]
+}