mirror of
https://github.com/sbrow/strings.git
synced 2025-12-29 23:17:39 -05:00
feat: Added docs.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import fc from 'fast-check';
|
||||
import {
|
||||
/*afterFirstWord, beforeFirstWord, endsWith,*/ ltrim, startsWith,
|
||||
/*afterFirstWord, beforeFirstWord, */ endsWith, ltrim, startsWith,
|
||||
} from './index';
|
||||
|
||||
describe('strings', () => {
|
||||
@@ -20,6 +20,21 @@ describe('strings', () => {
|
||||
}));
|
||||
})
|
||||
});
|
||||
describe('endsWith', () => {
|
||||
it('returns true if haystack end with needle', () => {
|
||||
expect(endsWith('bar', 'foobar')).toBe(true);
|
||||
})
|
||||
it('returns true when haystack is needle', () => {
|
||||
expect(endsWith('foo', 'foo')).toBe(true);
|
||||
})
|
||||
it('works', () => {
|
||||
fc.assert(fc.property(fc.string(), fc.string(), (needle, haystack) => {
|
||||
if (haystack.substring(haystack.indexOf(needle)) == needle) {
|
||||
expect(endsWith(needle, haystack)).toBe(true);
|
||||
}
|
||||
}));
|
||||
})
|
||||
});
|
||||
// describe('afterFirstWord', () => {
|
||||
// it('removes the first word', () => {
|
||||
// fc.assert(fc.property(fc.string(), (str) => {
|
||||
|
||||
Reference in New Issue
Block a user