Skip to content

Instantly share code, notes, and snippets.

@dgg
Created September 11, 2018 19:57
Show Gist options
  • Save dgg/e96e62ac21621c1b117b6a5dff6a3b11 to your computer and use it in GitHub Desktop.
Save dgg/e96e62ac21621c1b117b6a5dff6a3b11 to your computer and use it in GitHub Desktop.
test-last-ts
describe("leftFromFirst", () => {
const testSpec = [
{args: [null, "lazy lazy fox jumped"], value : null, desc : "substring not found"},
//{args: ["", "lazy lazy fox jumped"], value : null, desc : "substring not found"},
{args: [null, ""], value : null, desc : "(null, '') --> null"},
{args: [null, null], value : null, desc : "(null, null) --> null"},
{args: [null, null], value : null, desc : "(null, null) --> null"},
//{args: ["", ""], value : null, desc : "(*, '') --> ''"},
//{args: ["", null], value : '', desc : "(*, null) --> ''"},
]
testSpec.forEach(t => {
it(`conforms to spec [${t.desc}]`, ()=>{
expect(subject.leftFromFirst.apply(null, t.args)).to.equal(t.value)
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment