-
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
1 parent
a526697
commit 4393844
Showing
3 changed files
with
54 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,43 @@ | ||
import { FloatGenerator, FloatGeneratorConfig, IntegerGenerator, IntegerGeneratorConfig } from '../../../src'; | ||
import { | ||
FloatGenerator, | ||
FloatGeneratorConfig, | ||
} from '../../../src'; | ||
|
||
describe("FloatGenerator class", () => { | ||
it("should return a float within a given range (without precision)", () => { | ||
describe('FloatGenerator class', () => { | ||
it('should return a float within a given range (without precision)', () => { | ||
const conf: FloatGeneratorConfig = { | ||
min: 0, | ||
max: 3 | ||
} | ||
max: 3, | ||
}; | ||
|
||
const generator = new FloatGenerator(conf); | ||
|
||
expect(generator.get()).toBeGreaterThanOrEqual(0) | ||
expect(generator.get()).toBeLessThanOrEqual(3) | ||
}) | ||
expect(generator.get()).toBeGreaterThanOrEqual(0); | ||
expect(generator.get()).toBeLessThanOrEqual(3); | ||
}); | ||
|
||
it("should return a float within a given range (with precision)", () => { | ||
it('should return a float within a given range (with precision)', () => { | ||
const conf: FloatGeneratorConfig = { | ||
min: 0, | ||
max: 3, | ||
decimalDigits: 4 | ||
} | ||
decimalDigits: 4, | ||
}; | ||
|
||
const generator = new FloatGenerator(conf); | ||
|
||
expect(generator.get()).toBeGreaterThanOrEqual(0) | ||
expect(generator.get()).toBeLessThanOrEqual(3) | ||
expect(`${generator.get()}`.split(".")[1]!.length).toBeLessThanOrEqual(4); | ||
}) | ||
expect(generator.get()).toBeGreaterThanOrEqual(0); | ||
expect(generator.get()).toBeLessThanOrEqual(3); | ||
expect(`${generator.get()}`.split('.')[1]!.length).toBeLessThanOrEqual(4); | ||
}); | ||
|
||
it("should trigger the pipe", () => { | ||
it('should trigger the pipe', () => { | ||
const conf: FloatGeneratorConfig = { | ||
min: 0, | ||
max: 3, | ||
pipes: [() => "test"] | ||
} | ||
pipes: [() => 'test'], | ||
}; | ||
|
||
const generator = new FloatGenerator(conf); | ||
expect(generator.get()).toBe("test") | ||
}) | ||
}) | ||
expect(generator.get()).toBe('test'); | ||
}); | ||
}); |
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,26 +1,26 @@ | ||
import { IntegerGenerator, IntegerGeneratorConfig } from '../../../src'; | ||
|
||
describe("IntegerGenerator class", () => { | ||
it("should return a integer number in a given range", () => { | ||
describe('IntegerGenerator class', () => { | ||
it('should return a integer number in a given range', () => { | ||
const conf: IntegerGeneratorConfig = { | ||
min: 0, | ||
max: 3 | ||
} | ||
max: 3, | ||
}; | ||
|
||
const generator = new IntegerGenerator(conf); | ||
|
||
expect(generator.get()).toBeGreaterThanOrEqual(0); | ||
expect(generator.get()).toBeLessThanOrEqual(3) | ||
}) | ||
expect(generator.get()).toBeLessThanOrEqual(3); | ||
}); | ||
|
||
it("should trigger the pipe", () => { | ||
it('should trigger the pipe', () => { | ||
const conf: IntegerGeneratorConfig = { | ||
min: 0, | ||
max: 3, | ||
pipes: [() => "test"] | ||
} | ||
pipes: [() => 'test'], | ||
}; | ||
|
||
const generator = new IntegerGenerator(conf); | ||
expect(generator.get()).toBe("test") | ||
}) | ||
}) | ||
expect(generator.get()).toBe('test'); | ||
}); | ||
}); |