Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pnowak committed Feb 22, 2023
1 parent cd25f49 commit a2a4414
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion src/tests/map-constructor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,57 @@ doNotExecute(() => {

const result = map.get('foo');

type tests = [Expect<Equal<typeof result, unknown>>];
type test = [Expect<Equal<typeof result, unknown>>];
});

doNotExecute(() => {
const map = new Map();

map.set('Jessie', {phone: '213-555-1234', address: '123 N 1st Ave'});

const result = map.has('Jessie');

type test = [Expect<Equal<typeof result, boolean>>];
});

doNotExecute(() => {
const map = new Map();

map.set('Jessie', {phone: '213-555-1234', address: '123 N 1st Ave'});

const result = map.get('Jessie');

type test = [Expect<Equal<typeof result, unknown>>];
});

doNotExecute(() => {
const map = new Map();

map.set('Jessie', {phone: '213-555-1234', address: '123 N 1st Ave'});

const result = map.delete('Jessie');

type test = [Expect<Equal<typeof result, boolean>>];
});

doNotExecute(() => {
const map = new Map();

map.set('Jessie', {phone: '213-555-1234', address: '123 N 1st Ave'});
map.set('Hilary', {phone: '617-555-4321', address: '321 S 2nd St'});

const size = map.size;

type testSize = [Expect<Equal<typeof size, number>>];
});

doNotExecute(() => {
const map = new Map();

map.set('Jessie', {phone: '213-555-1234', address: '123 N 1st Ave'});
map.set('Hilary', {phone: '617-555-4321', address: '321 S 2nd St'});

const cleared = map.clear();

type testClear = [Expect<Equal<typeof cleared, void>>];
});

0 comments on commit a2a4414

Please sign in to comment.