Skip to content

Releases: helpscout/helix

v0.2.0

18 May 16:16
Compare
Choose a tag to compare
  • Merge pull request #31 from helpscout/security-and-avatar ccb4aae
  • Fix babel command f218056

v0.1.3-0...v0.2.0

v0.1.2

01 May 12:59
Compare
Choose a tag to compare

Seeding: Generating different + consistent values for multiple fixtures

This update fixes the generate method for HelixSpec which ensures that if
multiple fixtures are being generated, then all of those fixtures use a
different seed index.

This allows for multiple fixtures to be consistently seeded, but have different
seeded results.

The generate accepts the initial seed value (e.g. 2), and increments it for
every iteration that it generates (e.g. 2, 3, 4, 5).

Resolves: #20

v0.1.1

17 Apr 13:32
Compare
Choose a tag to compare

Update package details and add src to .npmignore

Helix - v0.0.14

21 Mar 13:49
Compare
Choose a tag to compare

Fix oneOf export so that hs-app can import that helper

Change how we export oneOf to no longer use the export * from './helpers' format, since that way does not work properly with hs-app's webpack config (since tree shaking doesn't work quite right out of the box we had to shim the helix webpack config)

Thanks to @brettjonesdev !

Helix - v0.0.13

16 Nov 16:29
Compare
Choose a tag to compare

Add beforeGenerate and afterGenerate hooks

This update adds two new hook methods to HelixSpec: beforeGenerate
and afterGenerate.

These hooks allow you easily to adjust the shape/fixture data of
your specs, which can be handy for create alternate specs.

Example: afterGenerate()

const Dinosaur = createSpec({
  id: faker.random.number(),
  name: faker.name.firstName(),
  location: faker.address.country()
})

Dinosaur.afterGenerate(data => {
  const { name } = data
  return {
    name,
    location: 'Mexico',
    status: 'Happy',
    email: '[email protected]'
  }
})

Dinosaur.generate()
// {
//   name: 'Alice',
//   location: 'Mexico'
//   status: 'Happy',
//   email: '[email protected]'
// }

cc'ing @brettjonesdev ;)

Resolves: #11

Helix - v0.0.12

16 Nov 16:15
Compare
Choose a tag to compare

Fix bug where generate(0) returns a single spec instance instead of empty array

Helix - v0.0.11

13 Nov 19:40
Compare
Choose a tag to compare

Add new derived() function for better computeds

🍐 with @alisdair to add a new function that allows you to create
computed values based on existing data within the shape of the Spec.

Example

const Spec = createSpec({
  fname: () => 'Alice',
  lname: () => 'Baker',
  name: derived(({ fname, lname }) => `${fname} ${lname}`)
})
const fixture = Spec.generate()

Output

{
  fname: 'Alice',
  lname: 'Baker',
  name: 'Alice Baker'
}

faker.computed() has been deprecated in favour of the new derived() function.

Helix - v0.0.10

08 Nov 19:50
Compare
Choose a tag to compare

Add oneOf() helper function

Add oneOf() helper to create specs which return variable shapes.

Example

import { oneOf, createSpec, faker } from '@helpscout/helix'

const Tyrannosaurus = createSpec({
  id: faker.random.number(),
  type: 'meateater',
  name: faker.name.firstName()
})

const Stegosaurus = createSpec({
  id: faker.random.number(),
  type: 'planteater',
  name: faker.name.firstName()
})

const Dinosaur = oneOf([Tyrannosaurus, Stegosaurus])

Dinosaur.generate()
// Instance of either stegasaurus or tyrannosaurus

Read more here

Added by @brettjonesdev ❤️

Helix - v0.0.9

08 Nov 19:50
Compare
Choose a tag to compare

Fix bug where Spec.generate(0, 3) returns a non-array if the random count is 0

Spec.generate(0,3) wasn't returning [] when the random count was 0. Was treating the same as if we called Spec.generate() and returned a single spec instance, which is wrong.

Helix - v0.0.8

06 Nov 19:21
Compare
Choose a tag to compare

Support single value HelixSpecs

Feature

This PR allows the creation of HelixSpecs which return a single value. For example:

const UserType = new HelixSpec(faker.random.arrayElement(['user', 'guest', 'admin']))
const User = new HelixSpec({
  id: faker.random.number(),
  name: faker.name.firstName(),
  location: faker.address.country(),
  type: UserType
})