All Projects → jgrodziski → talltale

jgrodziski / talltale

Licence: EPL-1.0 license
A Clojure/ClojureScript Fake Data Generator Library

Programming Languages

clojure
4091 projects
shell
77523 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to talltale

Faker.js
generate massive amounts of realistic fake data in Node.js and the browser
Stars: ✭ 34,329 (+55269.35%)
Mutual labels:  fake, fake-data
random
Random data generator AKA faker
Stars: ✭ 14 (-77.42%)
Mutual labels:  fake, fake-data
Faker
Faker is a Python package that generates fake data for you.
Stars: ✭ 13,401 (+21514.52%)
Mutual labels:  fake, fake-data
dummy-products-api
An api to fetch dummy e-commerce product 👕 👗 👖 👚 JSON data with placeholder images.
Stars: ✭ 102 (+64.52%)
Mutual labels:  fake, fake-data
FakerDotNet
A .NET port of the Ruby faker gem
Stars: ✭ 15 (-75.81%)
Mutual labels:  fake, fake-data
MockSMS
Android application to create/craft fake sms.
Stars: ✭ 63 (+1.61%)
Mutual labels:  fake-data
moq.ts
Moq for Typescript
Stars: ✭ 107 (+72.58%)
Mutual labels:  fake
fakesudo
sudo almost as fake as your ma
Stars: ✭ 15 (-75.81%)
Mutual labels:  fake
Fake-Stream
Allows infinite streaming of a video as webcam output for different applications like Zoom, Skype etc.
Stars: ✭ 15 (-75.81%)
Mutual labels:  fake
jest-ts-auto-mock
Jest test utility with automatic mock creation for interfaces and classes
Stars: ✭ 150 (+141.94%)
Mutual labels:  fake
FakeNewsBlocker
Get a notification if a website is known to publish fake news
Stars: ✭ 15 (-75.81%)
Mutual labels:  fake
ts-mock-imports
Intuitive mocking library for Typescript class imports
Stars: ✭ 103 (+66.13%)
Mutual labels:  fake
common-random
简单易用的随机数据生成器。生成各种比较真实的假数据。一般用于开发和测试阶段的数据填充模拟。支持各类中国特色本地化的数据格式。An easy-to use random data generator. Generally used for data filling, simulation, demonstration and other scenarios in the development and test phase.
Stars: ✭ 397 (+540.32%)
Mutual labels:  fake-data
faker-cs
C# port of the Ruby Faker gem (http://faker.rubyforge.org/)
Stars: ✭ 159 (+156.45%)
Mutual labels:  fake-data
webvalve
Betterment's framework for locally developing and testing service-oriented apps in isolation with WebMock and Sinatra-based fakes
Stars: ✭ 111 (+79.03%)
Mutual labels:  fake
mock-data
Mock data in PostgreSQL/Greenplum databases
Stars: ✭ 115 (+85.48%)
Mutual labels:  fake-data
piggy
Test for spec compatibility and breaking changes.
Stars: ✭ 45 (-27.42%)
Mutual labels:  clojure-spec
react-fake-tweet
React renderer for tweets.
Stars: ✭ 33 (-46.77%)
Mutual labels:  fake
specialist-server
Spec-driven Clojure GraphQL server
Stars: ✭ 68 (+9.68%)
Mutual labels:  clojure-spec
FakePlayer
Specter but targeting PocketMine-MP API 4.0.0
Stars: ✭ 46 (-25.81%)
Mutual labels:  fake

Talltale

Talltale is a Clojure(Script) library that generates fake data, useful for prototyping or load testing. Can be used with clojure.spec for instance.

Clojars Project

Talltale provides traditional Clojure's functions that generates values but also test.check/clojure.spec generators (with -gen suffix). The date objects used are Java Time objects (version 0.3.0) instead of Joda Time.

I was inspired by the JFairy lib (I actually copied the nice data used by their generators).

  1. Installation
  2. Usage
  3. All Available Generators
  4. ClojureScript

Installation

Declare the lib dependency in Leiningen:

[talltale "0.4.3"]

Usage

Require the core namespace, every generators is merged into the core namespace for convenience.

(use '[talltale.core])

(company :fr) 
;; => {:address {:city "Le Perreux-sur-Marne", :postal-code "10000",
;;               :street "Grande Rue", :street-number 1},
;;     :domain "buapel.com", :email "[email protected]", :full-name "Buapel Ltd",
;;     :identification-number "00000001",
;;     :logo-url "http://via.placeholder.com/350x150?text=Buapel", :name "Buapel",
;;     :org-id "BUAPEL", :phone-number "0100000000", :tld "com", :type "Ltd",
;;     :url "https://www.buapel.com"}

(company);; default is always :en locale 
;; => {:address {:city "Miami", :postal-code "10076", :street "Ford Street",
;;               :street-number 233},
;;     :domain "adapt.com", :email "[email protected]",
;;     :full-name "Adapt Associates", :identification-number "12-0000016",
;;     :logo-url "http://via.placeholder.com/350x150?text=Adapt", :name "Adapt",
;;     :org-id "ADAPT", :phone-number "124-124-0124", :tld "com",
;;     :type "Associates", :url "https://www.adapt.com"}

(person)
;; => {:address {:city "San Francisco", :postal-code "10000",
;;            :street "Summer Place", :street-number 1},
;;  :age 37,
;;  :password  "62x4awex6m32s",
;;  :date-of-birth #object[org.joda.time.LocalDate 0x7d24c344 "1981-01-08"],
;;  :email "[email protected]", :first-name "Khloe", :last-name "Shannon",
;;  :phone-number "122-122-122",
;;  :picture-url "https://randomuser.me/api/portraits/women/4.jpg", :sex :female,
;;  :username "khloe"}
(username (first-name) (last-name))
(age);; => 56
(-> age date-of-birth);; => return a LocalDate object on JVM or cljs-time on JS
(first-name :fr);;random considering the gender (frequency 0f 0.5 for both)
(first-name-male :en);;=> "Logan"
(email (first-name) (last-name) );; => 
(picture-url :female)

;;you got the test.check generator version
(gen/sample (person-gen))

(address);; => {:city "San Francisco", :postal-code "10000",
         ;;     :street "Summer Place", :street-number 1}
(address-gen);; => return a Generator
(phone-number);;=> "124-124-0124"
(company-gen);; => return a Generator
(gen/sample (company-gen))
(lorem-ipsum)
(text)

Notes: I use test.check generators for numbers, so don't be surprised by the value as they respect the "Growth and Shrink" manner of test.check.

All available generators

(keys (ns-publics 'talltale.core))
;; Common
(text)
(lorem-ipsum) 

;; Address
(street-number) 
(street) 
(postal-code) 
(city) 
(phone-number) 
(address) 

;; Company
(org-id) 
(company-name) 
(company-type)
(function)
(email) 
(full-name) 
(company-email) 
(identification-number)
(tld) 
(domain) 
(url) 
(logo-url) 
(company) 

;; Person
(sex) 
(username) 
(password)
(first-name) 
(first-name-male) 
(first-name-female) 
(last-name) 
(last-name-male) 
(last-name-female) 
(age) 
(date-of-birth) 
(position)
(picture-url) 
(person-male) 
(person-female) 
(person) 

;;various generator

(quality)
;; => "robust" "unreal" etc.
(shape)
;; => "circular" "oval"
(color)
;; => "blue" "rose"
(animal)
;; => "horse" "koala" 
(landform)
;; => "moulin" "cave" 

Remember that you can just add the -gen suffix to get a test.check/clojure.spec generator and then use it with gen/sample.

Also each function/generator accept a locale as first argument with :en and :fr as the first ones provided.

ClojureScript

If you want to try Talltale with Planck:

planck -D talltale:0.2.11,com.andrewmcveigh/cljs-time:0.5.2,org.clojure/test.check:0.10.0-alpha2

then

(require 'talltale.core)
(in-ns 'talltale.core)

License

Copyright © 2019 Jeremie Grodziski

Distributed under the Eclipse Public License either version 1.0.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].