Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 73dbeac

Browse filesBrowse files
abacaphiliacleebyron
authored andcommitted
Adds test to demonstrate usage of Symbol primitive data type as Map key via set method, which does not work upon Map instantiation. (immutable-js#1394)
1 parent bcc932f commit 73dbeac
Copy full SHA for 73dbeac

File tree

1 file changed

+3
-0
lines changed
Filter options

1 file changed

+3
-0
lines changed

‎__tests__/Map.ts

Copy file name to clipboardExpand all lines: __tests__/Map.ts
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,14 @@ describe('Map', () => {
192192
});
193193

194194
it('can use weird keys', () => {
195+
const symbol = Symbol('A');
195196
const m: Map<any, any> = Map()
196197
.set(NaN, 1)
197198
.set(Infinity, 2)
199+
.set(symbol, 'A')
198200
.set(-Infinity, 3);
199201

202+
expect(m.get(symbol)).toBe('A');
200203
expect(m.get(NaN)).toBe(1);
201204
expect(m.get(Infinity)).toBe(2);
202205
expect(m.get(-Infinity)).toBe(3);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.