Skip to content

Commit c80746b

Browse files
committed
Clean up a bit, fix the deno test
1 parent 3cc4fc5 commit c80746b

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

test/types/array-like-type.spec.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,11 @@ describe('array-like type', () => {
148148
describe('when comparing instances of different classes that are identified by the same array-like subtype', () => {
149149
clonedExpect.addType({
150150
name: 'subtypeOfSimpleArrayLike',
151-
base: 'simpleArrayLike',
151+
base: 'array-like',
152152
identify(value) {
153153
return value && value._subtypeOfSimpleArrayLike;
154154
},
155+
numericalPropertiesOnly: true,
155156
});
156157

157158
class MyArray extends Array {
@@ -169,31 +170,32 @@ describe('array-like type', () => {
169170
}
170171

171172
it('should succeed when the elements match', () => {
172-
const a = new MyArray();
173-
a.push(123);
174-
const b = new MyOtherArray();
175-
b.push(123);
173+
const a = new MyArray(1);
174+
a.length = 1;
175+
a[0] = 123;
176+
const b = new MyOtherArray(1);
177+
b.length = 1;
178+
b[0] = 123;
176179

177180
clonedExpect(a, 'to equal', b);
178181
clonedExpect(b, 'to equal', a);
179182
});
180183

181184
it('should fail with a diff when the elements do not match', () => {
182-
const a = new MyArray();
183-
a.push(123);
184-
const b = new MyOtherArray();
185-
b.push(456);
185+
const a = new MyArray(1);
186+
a.length = 1;
187+
a[0] = 123;
188+
const b = new MyOtherArray(1);
189+
b.length = 1;
190+
b[0] = 456;
186191

187192
expect(
188193
() => clonedExpect(a, 'to equal', b),
189194
'to throw',
190-
'expected [ undefined, 123, _subtypeOfSimpleArrayLike: true ]\n' +
191-
'to equal [ undefined, 456, _subtypeOfSimpleArrayLike: true ]\n' +
195+
'expected [ 123 ] to equal [ 456 ]\n' +
192196
'\n' +
193197
'[\n' +
194-
' undefined,\n' +
195-
' 123, // should equal 456\n' +
196-
' _subtypeOfSimpleArrayLike: true\n' +
198+
' 123 // should equal 456\n' +
197199
']'
198200
);
199201
});

0 commit comments

Comments
 (0)