Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: split files #56

Merged
merged 8 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
split type tests
  • Loading branch information
jly36963 committed Oct 10, 2023
commit bbec18d919e0c6c509cb7050187f4fa7c792de4b
62 changes: 0 additions & 62 deletions src/casing/casing.types.test.ts

This file was deleted.

17 changes: 15 additions & 2 deletions src/casing/to-camel-case.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import { WEIRD_TEXT, SEPARATORS_TEXT } from '../internal/fixtures.js'
import { toCamelCase } from './to-camel-case.js'
import {
type WeirdTextUnion,
WEIRD_TEXT,
SEPARATORS_TEXT,
} from '../internal/fixtures.js'
import { type CamelCase, toCamelCase } from './to-camel-case.js'

namespace TypeTransforms {
type test = Expect<
Equal<
CamelCase<WeirdTextUnion>,
'someWeirdCased$*String1986FooBarWForWumbo' | 'dontDistributeUnions'
>
>
}

describe('toCamelCase', () => {
test('casing functions', () => {
Expand Down
14 changes: 12 additions & 2 deletions src/casing/to-constant-case.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { SEPARATORS_TEXT } from '../internal/fixtures.js'
import { toConstantCase } from './to-constant-case.js'
import { type WeirdTextUnion, SEPARATORS_TEXT } from '../internal/fixtures.js'
import { type ConstantCase, toConstantCase } from './to-constant-case.js'

namespace TypeTransforms {
type test = Expect<
Equal<
ConstantCase<WeirdTextUnion>,
| 'SOME_WEIRD_CASED_$*_STRING_1986_FOO_BAR_W_FOR_WUMBO'
| 'DONT_DISTRIBUTE_UNIONS'
>
>
}

describe('toConstantCase', () => {
test('casing functions', () => {
Expand Down
18 changes: 16 additions & 2 deletions src/casing/to-delimiter-case.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import { WEIRD_TEXT, SEPARATORS_TEXT } from '../internal/fixtures.js'
import { toDelimiterCase } from './to-delimiter-case.js'
import {
type WeirdTextUnion,
WEIRD_TEXT,
SEPARATORS_TEXT,
} from '../internal/fixtures.js'
import { type DelimiterCase, toDelimiterCase } from './to-delimiter-case.js'

namespace TypeTransforms {
type test = Expect<
Equal<
DelimiterCase<WeirdTextUnion, '%'>,
| 'some%Weird%cased%$*%String%1986%Foo%Bar%W%FOR%WUMBO'
| 'dont%distribute%unions'
>
>
}

describe('toDelimiterCase', () => {
test('casing functions', () => {
Expand Down
18 changes: 16 additions & 2 deletions src/casing/to-kebab-case.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import { WEIRD_TEXT, SEPARATORS_TEXT } from '../internal/fixtures.js'
import { toKebabCase } from './to-kebab-case.js'
import {
type WeirdTextUnion,
WEIRD_TEXT,
SEPARATORS_TEXT,
} from '../internal/fixtures.js'
import { type KebabCase, toKebabCase } from './to-kebab-case.js'

namespace TypeTransforms {
type test = Expect<
Equal<
KebabCase<WeirdTextUnion>,
| 'some-weird-cased-$*-string-1986-foo-bar-w-for-wumbo'
| 'dont-distribute-unions'
>
>
}

describe('toKebabCase', () => {
test('casing functions', () => {
Expand Down
17 changes: 15 additions & 2 deletions src/casing/to-pascal-case.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import { WEIRD_TEXT, SEPARATORS_TEXT } from '../internal/fixtures.js'
import { toPascalCase } from './to-pascal-case.js'
import {
type WeirdTextUnion,
WEIRD_TEXT,
SEPARATORS_TEXT,
} from '../internal/fixtures.js'
import { type PascalCase, toPascalCase } from './to-pascal-case.js'

namespace TypeTransforms {
type test = Expect<
Equal<
PascalCase<WeirdTextUnion>,
'SomeWeirdCased$*String1986FooBarWForWumbo' | 'DontDistributeUnions'
>
>
}

describe('toPascelCase', () => {
test('casing functions', () => {
Expand Down
18 changes: 16 additions & 2 deletions src/casing/to-snake-case.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import { WEIRD_TEXT, SEPARATORS_TEXT } from '../internal/fixtures.js'
import { toSnakeCase } from './to-snake-case.js'
import {
type WeirdTextUnion,
WEIRD_TEXT,
SEPARATORS_TEXT,
} from '../internal/fixtures.js'
import { type SnakeCase, toSnakeCase } from './to-snake-case.js'

namespace TypeTransforms {
type test = Expect<
Equal<
SnakeCase<WeirdTextUnion>,
| 'some_weird_cased_$*_string_1986_foo_bar_w_for_wumbo'
| 'dont_distribute_unions'
>
>
}

describe('toSnakeCase', () => {
test('casing functions', () => {
Expand Down
18 changes: 16 additions & 2 deletions src/casing/to-title-case.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import { WEIRD_TEXT, SEPARATORS_TEXT } from '../internal/fixtures.js'
import { toTitleCase } from './to-title-case.js'
import {
type WeirdTextUnion,
WEIRD_TEXT,
SEPARATORS_TEXT,
} from '../internal/fixtures.js'
import { type TitleCase, toTitleCase } from './to-title-case.js'

namespace TypeTransforms {
type test = Expect<
Equal<
TitleCase<WeirdTextUnion>,
| 'Some Weird Cased $* String 1986 Foo Bar W For Wumbo'
| 'Dont Distribute Unions'
>
>
}

describe('toTitleCase', () => {
test('casing functions', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/internal/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ export const SEPARATORS_TEXT =

export const WEIRD_TEXT =
' someWeird-cased$*String1986Foo [Bar] W_FOR_WUMBO...' as const

export type WeirdTextUnion = typeof WEIRD_TEXT | 'dont.distribute unions'
6 changes: 5 additions & 1 deletion src/native/char-at.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { charAt } from './char-at.js'
import { type CharAt, charAt } from './char-at.js'

namespace TypeTests {
type test = Expect<Equal<CharAt<'some nice string', 5>, 'n'>>
}

describe('charAt', () => {
test('should get the character of a string at the given index in both type and runtime level', () => {
Expand Down
8 changes: 7 additions & 1 deletion src/native/concat.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { concat } from './concat.js'
import { type Concat, concat } from './concat.js'

namespace TypeTests {
type test = Expect<
Equal<Concat<['a', 'bc', 'def'] | ['1', '23', '456']>, 'abcdef' | '123456'>
>
}

describe('concat', () => {
test('concatenates', () => {
Expand Down
6 changes: 5 additions & 1 deletion src/native/ends-with.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { endsWith } from './ends-with.js'
import { type EndsWith, endsWith } from './ends-with.js'

namespace TypeTests {
type test = Expect<Equal<EndsWith<'abc', 'c'>, true>>
}

describe('endsWith', () => {
const text = 'abc'
Expand Down
6 changes: 5 additions & 1 deletion src/native/includes.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { includes } from './includes.js'
import { type Includes, includes } from './includes.js'

namespace TypeTests {
type test = Expect<Equal<Includes<'abcde', 'bcd'>, true>>
}

describe('includes', () => {
const text = 'abcde'
Expand Down
8 changes: 7 additions & 1 deletion src/native/join.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { join } from './join.js'
import { type Join, join } from './join.js'

namespace TypeTests {
type test = Expect<
Equal<Join<['some', 'nice', 'string'], ' '>, 'some nice string'>
>
}

describe('join', () => {
test('should join words in both type level and runtime level', () => {
Expand Down
6 changes: 5 additions & 1 deletion src/native/length.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { length } from './length.js'
import { type Length, length } from './length.js'

namespace TypeTests {
type test = Expect<Equal<Length<'some nice string'>, 16>>
}

describe('length', () => {
test('should return the lenght of a string at both type level and runtime level', () => {
Expand Down
47 changes: 0 additions & 47 deletions src/native/primitives.types.test.ts

This file was deleted.

8 changes: 7 additions & 1 deletion src/native/replace-all.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { replaceAll } from './replace-all.js'
import { type ReplaceAll, replaceAll } from './replace-all.js'

namespace TypeTests {
type test = Expect<
Equal<ReplaceAll<'some nice string', ' ', '-'>, 'some-nice-string'>
>
}

beforeEach(() => {
vi.clearAllMocks()
Expand Down
8 changes: 7 additions & 1 deletion src/native/replace.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { replace } from './replace.js'
import { type Replace, replace } from './replace.js'

namespace TypeTests {
type test = Expect<
Equal<Replace<'some nice string', ' ', '-'>, 'some-nice string'>
>
}

describe('replace', () => {
test('should replace chars in a string at both type level and runtime level once', () => {
Expand Down
6 changes: 5 additions & 1 deletion src/native/slice.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { slice } from './slice.js'
import { type Slice, slice } from './slice.js'

namespace TypeTests {
type test = Expect<Equal<Slice<'some nice string', 5>, 'nice string'>>
}

describe('slice', () => {
const str = 'The quick brown fox jumps over the lazy dog.'
Expand Down
8 changes: 7 additions & 1 deletion src/native/split.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { split } from './split.js'
import { type Split, split } from './split.js'

namespace TypeTests {
type test = Expect<
Equal<Split<'some nice string', ' '>, ['some', 'nice', 'string']>
>
}

describe('split', () => {
test('should split a string by a delimiter into an array of substrings', () => {
Expand Down
6 changes: 5 additions & 1 deletion src/native/starts-with.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { startsWith } from './starts-with.js'
import { type StartsWith, startsWith } from './starts-with.js'

namespace TypeTests {
type test = Expect<Equal<StartsWith<'abc', 'a'>, true>>
}

describe('startsWith', () => {
const text = 'abc'
Expand Down
6 changes: 5 additions & 1 deletion src/native/trim-end.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { trimEnd } from './trim-end.js'
import { type TrimEnd, trimEnd } from './trim-end.js'

namespace TypeTests {
type test = Expect<Equal<TrimEnd<' some nice string '>, ' some nice string'>>
}

describe('trimEnd', () => {
test('should trim the end of a string at both type level and runtime level', () => {
Expand Down
Loading