You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.4 KiB

5 years ago
export const tests = []
const t = (f) => tests.push(f)
t(({ eq }) =>
// no pronouns
5 years ago
eq(
pronoun(`Your reducer function's returned value is assigned to the accumulator,
whose value is remembered across each iteration throughout the array and
ultimately becomes the final, single resulting value.`),
{}
)
5 years ago
)
t(({ eq }) =>
// simple count
5 years ago
eq(
pronoun(`The seal method seals an object, preventing new properties from being
added to it and marking all existing properties as non-configurable. Values of present
properties can still be changed as long as they are writable.`),
{
it: { word: ['and'], count: 1 },
they: { word: ['are'], count: 1 },
}
)
5 years ago
)
t(({ eq }) =>
// multiple pronouns
5 years ago
eq(pronoun('I buy,\ni to,\nYOU buy,\nit have,\nIt buys,\nit is,\nyou go'), {
i: { word: ['buy', 'to'], count: 2 },
you: { word: ['buy', 'go'], count: 2 },
it: { word: ['have', 'buys', 'is'], count: 3 },
})
5 years ago
)
t(({ eq }) =>
// repetition of pronouns
5 years ago
eq(pronoun(`it i it she is gone`), {
it: { word: [], count: 2 },
i: { word: [], count: 1 },
she: { word: ['is'], count: 1 },
})
5 years ago
)
t(({ eq }) =>
// repetition of same pronoun
eq(pronoun('she she she she is'), { she: { word: ['is'], count: 4 } })
5 years ago
)
t(({ eq }) =>
// pronoun with out verb
5 years ago
eq(pronoun('we will rock you'), {
we: { word: ['will'], count: 1 },
you: { word: [], count: 1 },
})
5 years ago
)
Object.freeze(tests)