stalniy / bdd-lazy-var

Provides UI for testing frameworks such as mocha, jasmine and jest which allows to define lazy variables and subjects.
MIT License
162 stars 14 forks source link

Add support for `its` similar to rspec #25

Closed stalniy closed 6 years ago

stalniy commented 6 years ago
describe("User", () => {
  subject() => new User())

  its("role", () => expected.to.equal("member"))
})

Basically its is a wrapper around it and example above can be converted to

it("s role equals to member", () => {
  expect($subject.role).to.equal("member")
})
stalniy commented 6 years ago

Syntax like this will not require to add one more global variable:

its('role', is => is.expected.to.equal("member"))
dkniffin commented 6 years ago

Not sure if it'd be part of this issue or another, but it would also be great to have something like rspec's it { is_expected.to eq("member") } syntax, for when we're just testing the subject directly.

I guess the syntax for JS would be it(() => is.expected.to.equal("member"))

stalniy commented 6 years ago

@dkniffin I think it would be a good addition!

stalniy commented 6 years ago

available in bdd-lazy-var@2.4.0