@fluentfixture/core
Advanced tools
Comparing version 1.0.5 to 1.0.6-alpha.1
@@ -8,4 +8,4 @@ export declare const MIN_ARRAY_SIZE = 0; | ||
export declare const MAX_PERCENTAGE = 1; | ||
export declare const MIN_INTEGER = -9007199254740992; | ||
export declare const MAX_INTEGER = 9007199254740992; | ||
export declare const MIN_INTEGER: number; | ||
export declare const MAX_INTEGER: number; | ||
export declare const DEFAULT_MIN_NUMBER = 0; | ||
@@ -12,0 +12,0 @@ export declare const DEFAULT_MAX_NUMBER = 1000; |
@@ -11,4 +11,4 @@ "use strict"; | ||
exports.MAX_PERCENTAGE = 1; | ||
exports.MIN_INTEGER = -9007199254740992; | ||
exports.MAX_INTEGER = 9007199254740992; | ||
exports.MIN_INTEGER = Number.MIN_SAFE_INTEGER; | ||
exports.MAX_INTEGER = Number.MAX_SAFE_INTEGER; | ||
exports.DEFAULT_MIN_NUMBER = 0; | ||
@@ -15,0 +15,0 @@ exports.DEFAULT_MAX_NUMBER = 1000; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BooleanFactory = void 0; | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const assert_1 = require("../assertions/assert"); | ||
const limits_1 = require("../constants/limits"); | ||
const random_1 = require("../engine/random"); | ||
const factory_1 = require("./factory"); | ||
@@ -16,3 +16,3 @@ class BooleanFactory extends factory_1.Factory { | ||
single() { | ||
return random_1.Random.bool(this.percentage); | ||
return shared_1.Random.bool(this.percentage); | ||
} | ||
@@ -19,0 +19,0 @@ getPercentage() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DateFactory = void 0; | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const assert_1 = require("../assertions/assert"); | ||
const random_1 = require("../engine/random"); | ||
const factory_1 = require("./factory"); | ||
@@ -16,3 +16,3 @@ class DateFactory extends factory_1.Factory { | ||
single() { | ||
return random_1.Random.date(this.min, this.max); | ||
return shared_1.Random.date(this.min, this.max); | ||
} | ||
@@ -19,0 +19,0 @@ getMin() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Picker = void 0; | ||
const random_1 = require("../../engine/random"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const decorator_1 = require("./decorator"); | ||
@@ -11,5 +11,5 @@ class Picker extends decorator_1.Decorator { | ||
single() { | ||
return random_1.Random.pick(this.factory.single()); | ||
return shared_1.Random.pick(this.factory.single()); | ||
} | ||
} | ||
exports.Picker = Picker; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Sampler = void 0; | ||
const random_1 = require("../../engine/random"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const assert_1 = require("../../assertions/assert"); | ||
@@ -16,3 +16,3 @@ const limits_1 = require("../../constants/limits"); | ||
single() { | ||
return random_1.Random.sample(this.factory.single(), this.size); | ||
return shared_1.Random.sample(this.factory.single(), this.size); | ||
} | ||
@@ -19,0 +19,0 @@ getSize() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Shuffler = void 0; | ||
const random_1 = require("../../engine/random"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const decorator_1 = require("./decorator"); | ||
@@ -11,5 +11,5 @@ class Shuffler extends decorator_1.Decorator { | ||
single() { | ||
return random_1.Random.shuffle(this.factory.single()); | ||
return shared_1.Random.shuffle(this.factory.single()); | ||
} | ||
} | ||
exports.Shuffler = Shuffler; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IntegerFactory = void 0; | ||
const random_1 = require("../engine/random"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const assert_1 = require("../assertions/assert"); | ||
@@ -19,3 +19,3 @@ const limits_1 = require("../constants/limits"); | ||
single() { | ||
return random_1.Random.integer(this.min, this.max); | ||
return shared_1.Random.integer(this.min, this.max); | ||
} | ||
@@ -22,0 +22,0 @@ getMin() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NumberFactory = void 0; | ||
const random_1 = require("../engine/random"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const assert_1 = require("../assertions/assert"); | ||
@@ -19,3 +19,3 @@ const limits_1 = require("../constants/limits"); | ||
single() { | ||
return random_1.Random.float(this.min, this.max); | ||
return shared_1.Random.float(this.min, this.max); | ||
} | ||
@@ -22,0 +22,0 @@ getMin() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Selector = void 0; | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const factory_1 = require("../factory"); | ||
const random_1 = require("../../engine/random"); | ||
const assert_1 = require("../../assertions/assert"); | ||
@@ -20,3 +20,3 @@ const limits_1 = require("../../constants/limits"); | ||
single() { | ||
return random_1.Random.bool(this.percentage) | ||
return shared_1.Random.bool(this.percentage) | ||
? this.factory1.single() | ||
@@ -23,0 +23,0 @@ : this.factory2.single(); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StringFactory = void 0; | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const assert_1 = require("../assertions/assert"); | ||
const limits_1 = require("../constants/limits"); | ||
const random_1 = require("../engine/random"); | ||
const factory_1 = require("./factory"); | ||
@@ -21,3 +21,3 @@ class StringFactory extends factory_1.Factory { | ||
single() { | ||
return random_1.Random.string(this.charset, this.minLength, this.maxLength); | ||
return shared_1.Random.string(this.charset, this.minLength, this.maxLength); | ||
} | ||
@@ -24,0 +24,0 @@ getCharset() { |
import { ArrayStream, Stream } from '../streams/stream-loader'; | ||
export declare const list: <T = any>(array: readonly T[]) => ArrayStream<T>; | ||
export declare const pick: <T = any>(array: readonly T[]) => Stream<T>; | ||
export declare const sample: <T = any>(array: readonly T[], count?: number) => ArrayStream<T>; | ||
export declare const shuffle: <T = any>(array: readonly T[]) => ArrayStream<T>; | ||
export declare const list: <T = any>(array: ReadonlyArray<T>) => ArrayStream<T>; | ||
export declare const pick: <T = any>(array: ReadonlyArray<T>) => Stream<T>; | ||
export declare const sample: <T = any>(array: ReadonlyArray<T>, count?: number) => ArrayStream<T>; | ||
export declare const shuffle: <T = any>(array: ReadonlyArray<T>) => ArrayStream<T>; |
import { DateStream, NumberStream, Stream, StringStream } from '../streams/stream-loader'; | ||
export declare const asString: <T extends string>(stream: Stream<T>) => StringStream; | ||
export declare const asNumber: <T extends number>(stream: Stream<T>) => NumberStream; | ||
export declare const asDate: <T extends Date>(stream: Stream<T>) => DateStream; | ||
export declare const asString: <T extends NonNullable<string>>(stream: Stream<T>) => StringStream; | ||
export declare const asNumber: <T extends NonNullable<number>>(stream: Stream<T>) => NumberStream; | ||
export declare const asDate: <T extends NonNullable<Date>>(stream: Stream<T>) => DateStream; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.uint32 = exports.int32 = exports.byte = exports.one = exports.zero = exports.num = exports.int = exports.real = void 0; | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const limits_1 = require("../constants/limits"); | ||
const stream_loader_1 = require("../streams/stream-loader"); | ||
const integer_factory_1 = require("../factories/integer-factory"); | ||
const random_1 = require("../engine/random"); | ||
const converters_1 = require("./converters"); | ||
@@ -19,4 +19,4 @@ const value_1 = require("./value"); | ||
const BYTE = new stream_loader_1.NumberStream(new integer_factory_1.IntegerFactory(0, 255)); | ||
const INT_32 = (0, converters_1.asNumber)((0, value_1.from)(() => random_1.Random.int32())); | ||
const UINT_32 = (0, converters_1.asNumber)((0, value_1.from)(() => random_1.Random.uint32())); | ||
const INT_32 = (0, converters_1.asNumber)((0, value_1.from)(() => shared_1.Random.int32())); | ||
const UINT_32 = (0, converters_1.asNumber)((0, value_1.from)(() => shared_1.Random.uint32())); | ||
const zero = () => ZERO; | ||
@@ -23,0 +23,0 @@ exports.zero = zero; |
@@ -7,3 +7,2 @@ "use strict"; | ||
const stream_loader_1 = require("../streams/stream-loader"); | ||
const random_1 = require("../engine/random"); | ||
const converters_1 = require("./converters"); | ||
@@ -37,4 +36,4 @@ const value_1 = require("./value"); | ||
exports.alphanumeric = alphanumeric; | ||
const UUID4 = (0, converters_1.asString)((0, value_1.from)(() => random_1.Random.uuid4())); | ||
const UUID4 = (0, converters_1.asString)((0, value_1.from)(() => shared_1.Random.uuid4())); | ||
const uuid4 = () => UUID4; | ||
exports.uuid4 = uuid4; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ts_mockito_1 = require("ts-mockito"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const type_sets_1 = require("../data/type-sets"); | ||
const limits_1 = require("../../src/constants/limits"); | ||
const random_1 = require("../../src/engine/random"); | ||
const boolean_factory_1 = require("../../src/factories/boolean-factory"); | ||
@@ -27,3 +27,3 @@ describe('BooleanFactory', () => { | ||
it('should create a boolean by using engine', () => { | ||
const spyEngine = (0, ts_mockito_1.spy)(random_1.Random); | ||
const spyEngine = (0, ts_mockito_1.spy)(shared_1.Random); | ||
const percentage = 0.5; | ||
@@ -30,0 +30,0 @@ const out = true; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ts_mockito_1 = require("ts-mockito"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const type_sets_1 = require("../data/type-sets"); | ||
const random_1 = require("../../src/engine/random"); | ||
const date_factory_1 = require("../../src/factories/date-factory"); | ||
@@ -24,3 +24,3 @@ describe('DateFactory', () => { | ||
it('should create a date by using engine', () => { | ||
const spyEngine = (0, ts_mockito_1.spy)(random_1.Random); | ||
const spyEngine = (0, ts_mockito_1.spy)(shared_1.Random); | ||
const min = new Date(-100); | ||
@@ -27,0 +27,0 @@ const max = new Date(100); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ts_mockito_1 = require("ts-mockito"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const picker_1 = require("../../../src/factories/decorators/picker"); | ||
const random_1 = require("../../../src/engine/random"); | ||
const mock_factory_1 = require("../../mocks/mock-factory"); | ||
@@ -10,3 +10,3 @@ describe('Picker', () => { | ||
it('should picks a value from the array which generated by the given factory', () => { | ||
const spyEngine = (0, ts_mockito_1.spy)(random_1.Random); | ||
const spyEngine = (0, ts_mockito_1.spy)(shared_1.Random); | ||
const arr = [1, 2, 3]; | ||
@@ -13,0 +13,0 @@ const out = 1; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ts_mockito_1 = require("ts-mockito"); | ||
const random_1 = require("../../../src/engine/random"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const mock_factory_1 = require("../../mocks/mock-factory"); | ||
@@ -28,3 +28,3 @@ const type_sets_1 = require("../../data/type-sets"); | ||
it('should takes values from the array which generated by the given factory', () => { | ||
const spyEngine = (0, ts_mockito_1.spy)(random_1.Random); | ||
const spyEngine = (0, ts_mockito_1.spy)(shared_1.Random); | ||
const size = 2; | ||
@@ -31,0 +31,0 @@ const arr = [1, 2, 3]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ts_mockito_1 = require("ts-mockito"); | ||
const random_1 = require("../../../src/engine/random"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const mock_factory_1 = require("../../mocks/mock-factory"); | ||
@@ -10,3 +10,3 @@ const shuffler_1 = require("../../../src/factories/decorators/shuffler"); | ||
it('should shuffles the array which generated by the given factory', () => { | ||
const spyEngine = (0, ts_mockito_1.spy)(random_1.Random); | ||
const spyEngine = (0, ts_mockito_1.spy)(shared_1.Random); | ||
const arr = [1, 2, 3]; | ||
@@ -13,0 +13,0 @@ const out = [1, 3, 2]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ts_mockito_1 = require("ts-mockito"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const type_sets_1 = require("../data/type-sets"); | ||
const limits_1 = require("../../src/constants/limits"); | ||
const integer_factory_1 = require("../../src/factories/integer-factory"); | ||
const random_1 = require("../../src/engine/random"); | ||
describe('IntegerFactory', () => { | ||
@@ -41,3 +41,3 @@ describe('.constructor()', () => { | ||
it('should create an integer by using engine', () => { | ||
const spyEngine = (0, ts_mockito_1.spy)(random_1.Random); | ||
const spyEngine = (0, ts_mockito_1.spy)(shared_1.Random); | ||
const min = 1; | ||
@@ -44,0 +44,0 @@ const max = 10; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ts_mockito_1 = require("ts-mockito"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const type_sets_1 = require("../data/type-sets"); | ||
const limits_1 = require("../../src/constants/limits"); | ||
const random_1 = require("../../src/engine/random"); | ||
const number_factory_1 = require("../../src/factories/number-factory"); | ||
@@ -41,3 +41,3 @@ describe('NumberFactory', () => { | ||
it('should create a number by using engine', () => { | ||
const spyEngine = (0, ts_mockito_1.spy)(random_1.Random); | ||
const spyEngine = (0, ts_mockito_1.spy)(shared_1.Random); | ||
const min = 0; | ||
@@ -44,0 +44,0 @@ const max = 1; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ts_mockito_1 = require("ts-mockito"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const type_sets_1 = require("../../data/type-sets"); | ||
@@ -8,3 +9,2 @@ const mock_factory_1 = require("../../mocks/mock-factory"); | ||
const limits_1 = require("../../../src/constants/limits"); | ||
const random_1 = require("../../../src/engine/random"); | ||
const factory_1 = require("../../../src/factories/factory"); | ||
@@ -48,3 +48,3 @@ describe('Selector', () => { | ||
it('should select a first factory when engine returns true', () => { | ||
const spyEngine = (0, ts_mockito_1.spy)(random_1.Random); | ||
const spyEngine = (0, ts_mockito_1.spy)(shared_1.Random); | ||
const percentage = 0.5; | ||
@@ -64,3 +64,3 @@ const factory1 = (0, ts_mockito_1.mock)(factory_1.Factory); | ||
it('should select a second factory when engine returns false', () => { | ||
const spyEngine = (0, ts_mockito_1.spy)(random_1.Random); | ||
const spyEngine = (0, ts_mockito_1.spy)(shared_1.Random); | ||
const percentage = 0.5; | ||
@@ -67,0 +67,0 @@ const factory1 = (0, ts_mockito_1.mock)(factory_1.Factory); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ts_mockito_1 = require("ts-mockito"); | ||
const shared_1 = require("@fluentfixture/shared"); | ||
const type_sets_1 = require("../data/type-sets"); | ||
const limits_1 = require("../../src/constants/limits"); | ||
const random_1 = require("../../src/engine/random"); | ||
const string_factory_1 = require("../../src/factories/string-factory"); | ||
@@ -47,3 +47,3 @@ describe('StringFactory', () => { | ||
it('should create a string by using engine', () => { | ||
const spyEngine = (0, ts_mockito_1.spy)(random_1.Random); | ||
const spyEngine = (0, ts_mockito_1.spy)(shared_1.Random); | ||
const minLength = 5; | ||
@@ -50,0 +50,0 @@ const maxLength = 10; |
{ | ||
"name": "@fluentfixture/core", | ||
"description": "A flexible tool for generating customizable mock data with fluent interface.", | ||
"version": "1.0.5", | ||
"version": "1.0.6-alpha.1", | ||
"license": "MIT", | ||
@@ -43,8 +43,6 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@fluentfixture/format": "^1.0.5", | ||
"@fluentfixture/shared": "^1.0.5", | ||
"random-js": "2.1.0", | ||
"randomstring": "1.2.3" | ||
"@fluentfixture/format": "^1.0.6-alpha.1", | ||
"@fluentfixture/shared": "^1.0.6-alpha.1" | ||
}, | ||
"gitHead": "97d6f407b745441bc6b6b590c6a3b48f60450dda" | ||
"gitHead": "1b708788a1f088446a604eedf6684a3befe86594" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
222387
205
4250
1
- Removedrandom-js@2.1.0
- Removedrandomstring@1.2.3
- Removedarray-uniq@1.0.2(transitive)
- Removedrandombytes@2.0.3(transitive)
- Removedrandomstring@1.2.3(transitive)