-
-
Notifications
You must be signed in to change notification settings - Fork 733
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
DavertMik
committed
Jan 4, 2025
1 parent
304244b
commit bfa9bdd
Showing
18 changed files
with
1,231 additions
and
1,135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
let expect; | ||
let expect | ||
import('chai').then(chai => { | ||
expect = chai.expect; | ||
}); | ||
expect = chai.expect | ||
}) | ||
|
||
const { Assertion } = require('../../../lib/assert/empty'); | ||
const AssertionError = require('../../../lib/assert/error'); | ||
const { Assertion } = require('../../../lib/assert/empty') | ||
const AssertionError = require('../../../lib/assert/error') | ||
|
||
let empty; | ||
let empty | ||
|
||
describe('empty assertion', () => { | ||
beforeEach(() => { | ||
empty = new Assertion({ subject: 'web page' }); | ||
}); | ||
empty = new Assertion({ subject: 'web page' }) | ||
}) | ||
|
||
it('should check for something to be empty', () => { | ||
empty.assert(null); | ||
expect(() => empty.negate(null)).to.throw(AssertionError); | ||
}); | ||
empty.assert(null) | ||
expect(() => empty.negate(null)).to.throw(AssertionError) | ||
}) | ||
|
||
it('should check for something not to be empty', () => { | ||
empty.negate('something'); | ||
expect(() => empty.assert('something')).to.throw(AssertionError); | ||
}); | ||
empty.negate('something') | ||
expect(() => empty.assert('something')).to.throw(AssertionError) | ||
}) | ||
|
||
it('should provide nice assert error message', () => { | ||
empty.params.value = '/nothing'; | ||
const err = empty.getFailedAssertion(); | ||
expect(err.inspect()).to.equal("expected web page '/nothing' to be empty"); | ||
}); | ||
empty.params.value = '/nothing' | ||
const err = empty.getFailedAssertion() | ||
expect(err.inspect()).to.equal("expected web page '/nothing' to be empty") | ||
}) | ||
|
||
it('should provide nice negate error message', () => { | ||
empty.params.value = '/nothing'; | ||
const err = empty.getFailedNegation(); | ||
expect(err.inspect()).to.equal("expected web page '/nothing' not to be empty"); | ||
}); | ||
}); | ||
empty.params.value = '/nothing' | ||
const err = empty.getFailedNegation() | ||
expect(err.inspect()).to.equal("expected web page '/nothing' not to be empty") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
let expect; | ||
let expect | ||
import('chai').then(chai => { | ||
expect = chai.expect; | ||
}); | ||
expect = chai.expect | ||
}) | ||
|
||
const { Assertion } = require('../../../lib/assert/equal'); | ||
const AssertionError = require('../../../lib/assert/error'); | ||
const { Assertion } = require('../../../lib/assert/equal') | ||
const AssertionError = require('../../../lib/assert/error') | ||
|
||
let equal; | ||
let equal | ||
|
||
describe('equal assertion', () => { | ||
beforeEach(() => { | ||
equal = new Assertion({ jar: 'contents of webpage' }); | ||
}); | ||
equal = new Assertion({ jar: 'contents of webpage' }) | ||
}) | ||
|
||
it('should check for equality', () => { | ||
equal.assert('hello', 'hello'); | ||
expect(() => equal.negate('hello', 'hello')).to.throw(AssertionError); | ||
}); | ||
equal.assert('hello', 'hello') | ||
expect(() => equal.negate('hello', 'hello')).to.throw(AssertionError) | ||
}) | ||
|
||
it('should check for something not to be equal', () => { | ||
equal.negate('hello', 'hi'); | ||
expect(() => equal.assert('hello', 'hi')).to.throw(AssertionError); | ||
}); | ||
equal.negate('hello', 'hi') | ||
expect(() => equal.assert('hello', 'hi')).to.throw(AssertionError) | ||
}) | ||
|
||
it('should provide nice assert error message', () => { | ||
equal.params.expected = 'hello'; | ||
equal.params.actual = 'hi'; | ||
const err = equal.getFailedAssertion(); | ||
expect(err.inspect()).to.equal('expected contents of webpage "hello" to equal "hi"'); | ||
}); | ||
equal.params.expected = 'hello' | ||
equal.params.actual = 'hi' | ||
const err = equal.getFailedAssertion() | ||
expect(err.inspect()).to.equal('expected contents of webpage "hello" to equal "hi"') | ||
}) | ||
|
||
it('should provide nice negate error message', () => { | ||
equal.params.expected = 'hello'; | ||
equal.params.actual = 'hello'; | ||
const err = equal.getFailedNegation(); | ||
expect(err.inspect()).to.equal('expected contents of webpage "hello" not to equal "hello"'); | ||
}); | ||
}); | ||
equal.params.expected = 'hello' | ||
equal.params.actual = 'hello' | ||
const err = equal.getFailedNegation() | ||
expect(err.inspect()).to.equal('expected contents of webpage "hello" not to equal "hello"') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
let expect; | ||
let expect | ||
import('chai').then(chai => { | ||
expect = chai.expect; | ||
}); | ||
expect = chai.expect | ||
}) | ||
|
||
const Assertion = require('../../../lib/assert/include').Assertion; | ||
const AssertionError = require('../../../lib/assert/error'); | ||
const Assertion = require('../../../lib/assert/include').Assertion | ||
const AssertionError = require('../../../lib/assert/error') | ||
|
||
let equal; | ||
let equal | ||
|
||
describe('equal assertion', () => { | ||
beforeEach(() => { | ||
equal = new Assertion({ jar: 'contents of webpage' }); | ||
}); | ||
equal = new Assertion({ jar: 'contents of webpage' }) | ||
}) | ||
|
||
it('should check for inclusion', () => { | ||
equal.assert('h', 'hello'); | ||
expect(() => equal.negate('h', 'hello')).to.throw(AssertionError); | ||
}); | ||
equal.assert('h', 'hello') | ||
expect(() => equal.negate('h', 'hello')).to.throw(AssertionError) | ||
}) | ||
|
||
it('should check !include', () => { | ||
equal.negate('x', 'hello'); | ||
expect(() => equal.assert('x', 'hello')).to.throw(AssertionError); | ||
}); | ||
equal.negate('x', 'hello') | ||
expect(() => equal.assert('x', 'hello')).to.throw(AssertionError) | ||
}) | ||
|
||
it('should provide nice assert error message', () => { | ||
equal.params.needle = 'hello'; | ||
equal.params.haystack = 'x'; | ||
const err = equal.getFailedAssertion(); | ||
expect(err.inspect()).to.equal('expected contents of webpage to include "hello"'); | ||
}); | ||
equal.params.needle = 'hello' | ||
equal.params.haystack = 'x' | ||
const err = equal.getFailedAssertion() | ||
expect(err.inspect()).to.equal('expected contents of webpage to include "hello"') | ||
}) | ||
|
||
it('should provide nice negate error message', () => { | ||
equal.params.needle = 'hello'; | ||
equal.params.haystack = 'h'; | ||
const err = equal.getFailedNegation(); | ||
expect(err.inspect()).to.equal('expected contents of webpage not to include "hello"'); | ||
}); | ||
}); | ||
equal.params.needle = 'hello' | ||
equal.params.haystack = 'h' | ||
const err = equal.getFailedNegation() | ||
expect(err.inspect()).to.equal('expected contents of webpage not to include "hello"') | ||
}) | ||
}) |
Oops, something went wrong.