Skip to content

Commit

Permalink
add a failing test for an interface type
Browse files Browse the repository at this point in the history
Co-authored-by: Jon Koops <jonkoops@gmail.com>
  • Loading branch information
dcousens and jonkoops committed Dec 26, 2023
1 parent 86601e9 commit fced60b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
14 changes: 14 additions & 0 deletions tests/bind.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import {expectError} from 'tsd';
import bind from '../bind';

type Foo = {
bar: boolean;
};

const foo: Foo = { bar: true };

interface IFoo {
bar: boolean;
}

const ifoo: IFoo = { bar: true };

// bind
bind.default.bind({foo: 'bar'});
const bound = bind.bind({foo: 'bar'});
Expand All @@ -22,6 +34,8 @@ bound('bar', null, undefined, true, false, 1234);
bound('bar', ['abc', { foo: true }]);
bound('bar', ['abc', { foo: true }], { def: false, ijk: 1234 });
bound('abc', 1234, true, false, undefined, null, { foo: true }, ['abc', 1234, true, false, undefined, null, { foo: true }]);
bound(foo);
bound(ifoo);
expectError(bound(Symbol()));
expectError(bound([Symbol()]));
expectError(bound([[Symbol()]]));
14 changes: 14 additions & 0 deletions tests/dedupe.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import {expectError} from 'tsd';
import dedupe from '../dedupe';

type Foo = {
bar: boolean;
};

const foo: Foo = { bar: true };

interface IFoo {
bar: boolean;
}

const ifoo: IFoo = { bar: true };

// dedupe
dedupe.default('foo');
dedupe('foo');
Expand All @@ -19,6 +31,8 @@ dedupe('bar', null, undefined, true, false, 1234);
dedupe('bar', ['abc', { foo: true }]);
dedupe('bar', ['abc', { foo: true }], { def: false, ijk: 1234 });
dedupe('abc', 1234, true, false, undefined, null, { foo: true }, ['abc', 1234, true, false, undefined, null, { foo: true }]);
dedupe(foo);
dedupe(ifoo);
expectError(dedupe(Symbol()));
expectError(dedupe([Symbol()]));
expectError(dedupe([[Symbol()]]));
16 changes: 14 additions & 2 deletions tests/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import {expectError} from 'tsd';
import classNames from '..';

type Foo = {
bar: boolean;
};

const foo: Foo = { bar: true };

interface IFoo {
bar: boolean;
}

const ifoo: IFoo = { bar: true };

// default
classNames.default('foo');
classNames('foo');
Expand All @@ -20,11 +32,11 @@ classNames('bar', ['abc', { foo: true }]);
classNames('bar', ['abc', { foo: true }], { def: false, ijk: 1234 });
classNames('abc', 1234, true, false, undefined, null, { foo: true }, ['abc', 1234, true, false, undefined, null, { foo: true }]);
classNames('abc', 1234, true, false, undefined, null, { foo: true }, ['abc', 1234, true, false, undefined, null, { foo: true }], ['abc', 1234, true, false, undefined, null, { foo: true }] as const);

classNames(foo);
classNames(ifoo);
expectError(classNames(Symbol()));
expectError(classNames([Symbol()]));
expectError(classNames([[Symbol()]]));

// should match tests/index.js
classNames('c', ['a', 'b']);
classNames('', 'b', {}, '');
Expand Down

0 comments on commit fced60b

Please sign in to comment.