-
Notifications
You must be signed in to change notification settings - Fork 0
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
Tamara Robichet
committed
May 2, 2019
1 parent
a7c9b46
commit 2f4cd47
Showing
7 changed files
with
211 additions
and
49 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
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
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
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
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
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,20 +1,20 @@ | ||
import * as assert from 'assert'; | ||
import Price from '../../../src/attribute/price'; | ||
import Digit from '../../../src/attribute/digit'; | ||
|
||
describe('creates a price attribute', () => { | ||
it('returns the number from a price string', () => { | ||
assert.equal(new Price('345 000 €').value, 345000); | ||
assert.equal(new Price('TAXE FONCIÈRE 423 €.').value, 423); | ||
describe('creates a digit attribute', () => { | ||
it('returns the number from a digit string', () => { | ||
assert.equal(new Digit('345 000 €').value, 345000); | ||
assert.equal(new Digit('TAXE FONCIÈRE 423 €.').value, 423); | ||
}); | ||
|
||
it('returns zero for an empty price', () => { | ||
assert.equal(new Price('There is no size in this string').value, null); | ||
it('returns zero for an empty digit', () => { | ||
assert.equal(new Digit('There is no size in this string').value, null); | ||
}); | ||
|
||
it('returns null if the price is not valid', () => { | ||
assert.equal(new Price(null).value, null); | ||
assert.equal(new Price(undefined).value, null); | ||
assert.equal(new Price('A string with no price').value, null); | ||
assert.equal(new Price(' ').value, null); | ||
it('returns null if the digit is not valid', () => { | ||
assert.equal(new Digit(null).value, null); | ||
assert.equal(new Digit(undefined).value, null); | ||
assert.equal(new Digit('A string with no digit').value, null); | ||
assert.equal(new Digit(' ').value, null); | ||
}); | ||
}); |
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