| 1 |
"use strict"; |
| 2 |
|
| 3 |
describe("babel-runtime", () => { |
| 4 |
describe("instance methods entries", () => { |
| 5 |
it("at, exists", () => { |
| 6 |
expect( |
| 7 |
require("../core-js/instance/at")("").call("a", 0), |
| 8 |
).toEqual("a"); |
| 9 |
}); |
| 10 |
|
| 11 |
it("at, missing", () => { |
| 12 |
expect( |
| 13 |
require("../core-js/instance/at")({}), |
| 14 |
).toEqual(undefined); |
| 15 |
}); |
| 16 |
|
| 17 |
it("bind, exists", () => { |
| 18 |
expect( |
| 19 |
require("../core-js/instance/bind")(() => {}).call(function () { return this; }, 42)(), |
| 20 |
).toEqual(42); |
| 21 |
}); |
| 22 |
|
| 23 |
it("bind, missing", () => { |
| 24 |
expect( |
| 25 |
require("../core-js/instance/bind")({}), |
| 26 |
).toEqual(undefined); |
| 27 |
}); |
| 28 |
|
| 29 |
it("codePointAt, exists", () => { |
| 30 |
expect( |
| 31 |
require("../core-js/instance/code-point-at")("").call("a", 0), |
| 32 |
).toEqual(97); |
| 33 |
}); |
| 34 |
|
| 35 |
it("codePointAt, missing", () => { |
| 36 |
expect( |
| 37 |
require("../core-js/instance/code-point-at")({}), |
| 38 |
).toEqual(undefined); |
| 39 |
}); |
| 40 |
|
| 41 |
it("codePoints, exists", () => { |
| 42 |
expect( |
| 43 |
typeof require("../core-js/instance/code-points")("").call("a").next, |
| 44 |
).toEqual("function"); |
| 45 |
}); |
| 46 |
|
| 47 |
it("codePoints, missing", () => { |
| 48 |
expect( |
| 49 |
require("../core-js/instance/code-points")({}), |
| 50 |
).toEqual(undefined); |
| 51 |
}); |
| 52 |
|
| 53 |
it("concat, exists", () => { |
| 54 |
expect( |
| 55 |
require("../core-js/instance/concat")([]).call([1, 2], [3, 4]).length, |
| 56 |
).toEqual(4); |
| 57 |
}); |
| 58 |
|
| 59 |
it("concat, missing", () => { |
| 60 |
expect( |
| 61 |
require("../core-js/instance/concat")({}), |
| 62 |
).toEqual(undefined); |
| 63 |
}); |
| 64 |
|
| 65 |
it("copyWithin, exists", () => { |
| 66 |
expect( |
| 67 |
require("../core-js/instance/copy-within")([]).call([1, 2, 3], 1)[2], |
| 68 |
).toEqual(2); |
| 69 |
}); |
| 70 |
|
| 71 |
it("copyWithin, missing", () => { |
| 72 |
expect( |
| 73 |
require("../core-js/instance/copy-within")({}), |
| 74 |
).toEqual(undefined); |
| 75 |
}); |
| 76 |
|
| 77 |
it("endsWith, exists", () => { |
| 78 |
expect( |
| 79 |
require("../core-js/instance/ends-with")("").call("qwe", "we"), |
| 80 |
).toEqual(true); |
| 81 |
}); |
| 82 |
|
| 83 |
it("endsWith, missing", () => { |
| 84 |
expect( |
| 85 |
require("../core-js/instance/ends-with")({}), |
| 86 |
).toEqual(undefined); |
| 87 |
}); |
| 88 |
|
| 89 |
it("entries, exists", () => { |
| 90 |
expect( |
| 91 |
require("../core-js/instance/entries")([]).call([]).next().done, |
| 92 |
).toEqual(true); |
| 93 |
}); |
| 94 |
|
| 95 |
it("entries, missing", () => { |
| 96 |
expect( |
| 97 |
require("../core-js/instance/entries")({}), |
| 98 |
).toEqual(undefined); |
| 99 |
}); |
| 100 |
|
| 101 |
it("every, exists", () => { |
| 102 |
expect( |
| 103 |
require("../core-js/instance/every")([]).call([1, 2, 3], it => typeof it === "number"), |
| 104 |
).toEqual(true); |
| 105 |
}); |
| 106 |
|
| 107 |
it("every, missing", () => { |
| 108 |
expect( |
| 109 |
require("../core-js/instance/every")({}), |
| 110 |
).toEqual(undefined); |
| 111 |
}); |
| 112 |
|
| 113 |
it("fill, exists", () => { |
| 114 |
expect( |
| 115 |
require("../core-js/instance/fill")([]).call([1, 2, 3], 42)[1], |
| 116 |
).toEqual(42); |
| 117 |
}); |
| 118 |
|
| 119 |
it("fill, missing", () => { |
| 120 |
expect( |
| 121 |
require("../core-js/instance/fill")({}), |
| 122 |
).toEqual(undefined); |
| 123 |
}); |
| 124 |
|
| 125 |
it("filter, exists", () => { |
| 126 |
expect( |
| 127 |
require("../core-js/instance/filter")([]).call([1, 2, 3], it => it % 2).length, |
| 128 |
).toEqual(2); |
| 129 |
}); |
| 130 |
|
| 131 |
it("filter, missing", () => { |
| 132 |
expect( |
| 133 |
require("../core-js/instance/filter")({}), |
| 134 |
).toEqual(undefined); |
| 135 |
}); |
| 136 |
|
| 137 |
it("find, exists", () => { |
| 138 |
expect( |
| 139 |
require("../core-js/instance/find")([]).call([1, 2, 3], it => !(it % 2)), |
| 140 |
).toEqual(2); |
| 141 |
}); |
| 142 |
|
| 143 |
it("find, missing", () => { |
| 144 |
expect( |
| 145 |
require("../core-js/instance/find")({}), |
| 146 |
).toEqual(undefined); |
| 147 |
}); |
| 148 |
|
| 149 |
it("findIndex, exists", () => { |
| 150 |
expect( |
| 151 |
require("../core-js/instance/find-index")([]).call([1, 2, 3], it => !(it % 2)), |
| 152 |
).toEqual(1); |
| 153 |
}); |
| 154 |
|
| 155 |
it("findIndex, missing", () => { |
| 156 |
expect( |
| 157 |
require("../core-js/instance/find-index")({}), |
| 158 |
).toEqual(undefined); |
| 159 |
}); |
| 160 |
|
| 161 |
it("flags, exists", () => { |
| 162 |
expect( |
| 163 |
require("../core-js/instance/flags")(/./gim), |
| 164 |
).toEqual("gim"); |
| 165 |
}); |
| 166 |
|
| 167 |
it("flags, missing", () => { |
| 168 |
expect( |
| 169 |
require("../core-js/instance/flags")({}), |
| 170 |
).toEqual(undefined); |
| 171 |
}); |
| 172 |
|
| 173 |
it("flatMap, exists", () => { |
| 174 |
expect( |
| 175 |
require("../core-js/instance/flat-map")([]).call([1, 2, [3, 4]], it => it).length, |
| 176 |
).toEqual(4); |
| 177 |
}); |
| 178 |
|
| 179 |
it("flatMap, missing", () => { |
| 180 |
expect( |
| 181 |
require("../core-js/instance/flat-map")({}), |
| 182 |
).toEqual(undefined); |
| 183 |
}); |
| 184 |
|
| 185 |
it("flat, exists", () => { |
| 186 |
expect( |
| 187 |
require("../core-js/instance/flat")([]).call([1, 2, [3, 4]]).length, |
| 188 |
).toEqual(4); |
| 189 |
}); |
| 190 |
|
| 191 |
it("flat, missing", () => { |
| 192 |
expect( |
| 193 |
require("../core-js/instance/flat")({}), |
| 194 |
).toEqual(undefined); |
| 195 |
}); |
| 196 |
|
| 197 |
it("forEach, exists", () => { |
| 198 |
expect( |
| 199 |
typeof require("../core-js/instance/for-each")([]), |
| 200 |
).toEqual("function"); |
| 201 |
}); |
| 202 |
|
| 203 |
it("forEach, missing", () => { |
| 204 |
expect( |
| 205 |
require("../core-js/instance/for-each")({}), |
| 206 |
).toEqual(undefined); |
| 207 |
}); |
| 208 |
|
| 209 |
it("includes, array", () => { |
| 210 |
expect( |
| 211 |
require("../core-js/instance/includes")([]).call([1, 2, 3], 2), |
| 212 |
).toEqual(true); |
| 213 |
}); |
| 214 |
|
| 215 |
it("includes, string", () => { |
| 216 |
expect( |
| 217 |
require("../core-js/instance/includes")("").call("qweasd", "ea"), |
| 218 |
).toEqual(true); |
| 219 |
}); |
| 220 |
|
| 221 |
it("includes, missing", () => { |
| 222 |
expect( |
| 223 |
require("../core-js/instance/includes")({}), |
| 224 |
).toEqual(undefined); |
| 225 |
}); |
| 226 |
|
| 227 |
it("indexOf, exists", () => { |
| 228 |
expect( |
| 229 |
require("../core-js/instance/index-of")([]).call([1, 2, 3], 4), |
| 230 |
).toEqual(-1); |
| 231 |
}); |
| 232 |
|
| 233 |
it("indexOf, missing", () => { |
| 234 |
expect( |
| 235 |
require("../core-js/instance/index-of")({}), |
| 236 |
).toEqual(undefined); |
| 237 |
}); |
| 238 |
|
| 239 |
it("keys, exists", () => { |
| 240 |
expect( |
| 241 |
require("../core-js/instance/keys")([]).call([]).next().done, |
| 242 |
).toEqual(true); |
| 243 |
}); |
| 244 |
|
| 245 |
it("keys, missing", () => { |
| 246 |
expect( |
| 247 |
require("../core-js/instance/keys")({}), |
| 248 |
).toEqual(undefined); |
| 249 |
}); |
| 250 |
|
| 251 |
it("lastIndexOf, exists", () => { |
| 252 |
expect( |
| 253 |
require("../core-js/instance/last-index-of")([]).call([1, 2, 3], 4), |
| 254 |
).toEqual(-1); |
| 255 |
}); |
| 256 |
|
| 257 |
it("lastIndexOf, missing", () => { |
| 258 |
expect( |
| 259 |
require("../core-js/instance/last-index-of")({}), |
| 260 |
).toEqual(undefined); |
| 261 |
}); |
| 262 |
|
| 263 |
it("map, exists", () => { |
| 264 |
expect( |
| 265 |
require("../core-js/instance/map")([]).call([1, 2, 3], it => it * it)[2], |
| 266 |
).toEqual(9); |
| 267 |
}); |
| 268 |
|
| 269 |
it("map, missing", () => { |
| 270 |
expect( |
| 271 |
require("../core-js/instance/map")({}), |
| 272 |
).toEqual(undefined); |
| 273 |
}); |
| 274 |
|
| 275 |
it("matchAll, exists", () => { |
| 276 |
expect( |
| 277 |
typeof require("../core-js/instance/match-all")("").call("qwe", /./g).next, |
| 278 |
).toEqual("function"); |
| 279 |
}); |
| 280 |
|
| 281 |
it("matchAll, missing", () => { |
| 282 |
expect( |
| 283 |
require("../core-js/instance/match-all")({}), |
| 284 |
).toEqual(undefined); |
| 285 |
}); |
| 286 |
|
| 287 |
it("padEnd, exists", () => { |
| 288 |
expect( |
| 289 |
require("../core-js/instance/pad-end")("").call("qwe", 6), |
| 290 |
).toEqual("qwe "); |
| 291 |
}); |
| 292 |
|
| 293 |
it("padEnd, missing", () => { |
| 294 |
expect( |
| 295 |
require("../core-js/instance/pad-end")({}), |
| 296 |
).toEqual(undefined); |
| 297 |
}); |
| 298 |
|
| 299 |
it("padStart, exists", () => { |
| 300 |
expect( |
| 301 |
require("../core-js/instance/pad-start")("").call("qwe", 6), |
| 302 |
).toEqual(" qwe"); |
| 303 |
}); |
| 304 |
|
| 305 |
it("padStart, missing", () => { |
| 306 |
expect( |
| 307 |
require("../core-js/instance/pad-start")({}), |
| 308 |
).toEqual(undefined); |
| 309 |
}); |
| 310 |
|
| 311 |
it("reduce, exists", () => { |
| 312 |
expect( |
| 313 |
require("../core-js/instance/reduce")([]).call([1, 2, 3], (a, b) => a + b), |
| 314 |
).toEqual(6); |
| 315 |
}); |
| 316 |
|
| 317 |
it("reduce, missing", () => { |
| 318 |
expect( |
| 319 |
require("../core-js/instance/reduce")({}), |
| 320 |
).toEqual(undefined); |
| 321 |
}); |
| 322 |
|
| 323 |
it("reduceRight, exists", () => { |
| 324 |
expect( |
| 325 |
require("../core-js/instance/reduce-right")([]).call([1, 2, 3], (a, b) => a + b), |
| 326 |
).toEqual(6); |
| 327 |
}); |
| 328 |
|
| 329 |
it("reduceRight, missing", () => { |
| 330 |
expect( |
| 331 |
require("../core-js/instance/reduce-right")({}), |
| 332 |
).toEqual(undefined); |
| 333 |
}); |
| 334 |
|
| 335 |
it("repeat, exists", () => { |
| 336 |
expect( |
| 337 |
require("../core-js/instance/repeat")("").call("q", 6), |
| 338 |
).toEqual("qqqqqq"); |
| 339 |
}); |
| 340 |
|
| 341 |
it("repeat, missing", () => { |
| 342 |
expect( |
| 343 |
require("../core-js/instance/repeat")({}), |
| 344 |
).toEqual(undefined); |
| 345 |
}); |
| 346 |
|
| 347 |
it("replaceAll, exists", () => { |
| 348 |
expect( |
| 349 |
require("../core-js/instance/replace-all")("").call("qwe", "w", "r"), |
| 350 |
).toEqual("qre"); |
| 351 |
}); |
| 352 |
|
| 353 |
it("replaceAll, missing", () => { |
| 354 |
expect( |
| 355 |
require("../core-js/instance/replace-all")({}), |
| 356 |
).toEqual(undefined); |
| 357 |
}); |
| 358 |
|
| 359 |
it("reverse, exists", () => { |
| 360 |
expect( |
| 361 |
require("../core-js/instance/reverse")([]).call([1, 2, 3]).join(''), |
| 362 |
).toEqual("321"); |
| 363 |
}); |
| 364 |
|
| 365 |
it("reverse, missing", () => { |
| 366 |
expect( |
| 367 |
require("../core-js/instance/reverse")({}), |
| 368 |
).toEqual(undefined); |
| 369 |
}); |
| 370 |
|
| 371 |
it("slice, exists", () => { |
| 372 |
expect( |
| 373 |
require("../core-js/instance/slice")([]).call([1, 2, 3], 1)[0], |
| 374 |
).toEqual(2); |
| 375 |
}); |
| 376 |
|
| 377 |
it("slice, missing", () => { |
| 378 |
expect( |
| 379 |
require("../core-js/instance/slice")({}), |
| 380 |
).toEqual(undefined); |
| 381 |
}); |
| 382 |
|
| 383 |
it("some, exists", () => { |
| 384 |
expect( |
| 385 |
require("../core-js/instance/some")([]).call([1, 2, 3], it => typeof it === "number"), |
| 386 |
).toEqual(true); |
| 387 |
}); |
| 388 |
|
| 389 |
it("some, missing", () => { |
| 390 |
expect( |
| 391 |
require("../core-js/instance/some")({}), |
| 392 |
).toEqual(undefined); |
| 393 |
}); |
| 394 |
|
| 395 |
it("sort, exists", () => { |
| 396 |
expect( |
| 397 |
typeof require("../core-js/instance/sort")([]), |
| 398 |
).toEqual("function"); |
| 399 |
}); |
| 400 |
|
| 401 |
it("sort, missing", () => { |
| 402 |
expect( |
| 403 |
require("../core-js/instance/sort")({}), |
| 404 |
).toEqual(undefined); |
| 405 |
}); |
| 406 |
|
| 407 |
it("splice, exists", () => { |
| 408 |
expect( |
| 409 |
typeof require("../core-js/instance/splice")([]), |
| 410 |
).toEqual("function"); |
| 411 |
}); |
| 412 |
|
| 413 |
it("splice, missing", () => { |
| 414 |
expect( |
| 415 |
require("../core-js/instance/splice")({}), |
| 416 |
).toEqual(undefined); |
| 417 |
}); |
| 418 |
|
| 419 |
it("startsWith, exists", () => { |
| 420 |
expect( |
| 421 |
require("../core-js/instance/starts-with")("").call("qwe", "qw"), |
| 422 |
).toEqual(true); |
| 423 |
}); |
| 424 |
|
| 425 |
it("startsWith, missing", () => { |
| 426 |
expect( |
| 427 |
require("../core-js/instance/starts-with")({}), |
| 428 |
).toEqual(undefined); |
| 429 |
}); |
| 430 |
|
| 431 |
it("trim, exists", () => { |
| 432 |
expect( |
| 433 |
require("../core-js/instance/trim")("").call(" qwe "), |
| 434 |
).toEqual("qwe"); |
| 435 |
}); |
| 436 |
|
| 437 |
it("trim, missing", () => { |
| 438 |
expect( |
| 439 |
require("../core-js/instance/trim")({}), |
| 440 |
).toEqual(undefined); |
| 441 |
}); |
| 442 |
|
| 443 |
it("trimEnd, exists", () => { |
| 444 |
expect( |
| 445 |
require("../core-js/instance/trim-end")("").call(" qwe "), |
| 446 |
).toEqual(" qwe"); |
| 447 |
}); |
| 448 |
|
| 449 |
it("trimEnd, missing", () => { |
| 450 |
expect( |
| 451 |
require("../core-js/instance/trim-end")({}), |
| 452 |
).toEqual(undefined); |
| 453 |
}); |
| 454 |
|
| 455 |
it("trimLeft, exists", () => { |
| 456 |
expect( |
| 457 |
require("../core-js/instance/trim-left")("").call(" qwe "), |
| 458 |
).toEqual("qwe "); |
| 459 |
}); |
| 460 |
|
| 461 |
it("trimLeft, missing", () => { |
| 462 |
expect( |
| 463 |
require("../core-js/instance/trim-left")({}), |
| 464 |
).toEqual(undefined); |
| 465 |
}); |
| 466 |
|
| 467 |
it("trimRight, exists", () => { |
| 468 |
expect( |
| 469 |
require("../core-js/instance/trim-right")("").call(" qwe "), |
| 470 |
).toEqual(" qwe"); |
| 471 |
}); |
| 472 |
|
| 473 |
it("trimRight, missing", () => { |
| 474 |
expect( |
| 475 |
require("../core-js/instance/trim-right")({}), |
| 476 |
).toEqual(undefined); |
| 477 |
}); |
| 478 |
|
| 479 |
it("trimStart, exists", () => { |
| 480 |
expect( |
| 481 |
require("../core-js/instance/trim-start")("").call(" qwe "), |
| 482 |
).toEqual("qwe "); |
| 483 |
}); |
| 484 |
|
| 485 |
it("trimStart, missing", () => { |
| 486 |
expect( |
| 487 |
require("../core-js/instance/trim-start")({}), |
| 488 |
).toEqual(undefined); |
| 489 |
}); |
| 490 |
|
| 491 |
it("values, exists", () => { |
| 492 |
expect( |
| 493 |
require("../core-js/instance/values")([]).call([]).next().done, |
| 494 |
).toEqual(true); |
| 495 |
}); |
| 496 |
|
| 497 |
it("values, missing", () => { |
| 498 |
expect( |
| 499 |
require("../core-js/instance/values")({}), |
| 500 |
).toEqual(undefined); |
| 501 |
}); |
| 502 |
}); |
| 503 |
}); |