test.test.js 356 B

1234567891011121314151617
  1. describe('test', () => {
  2. it('instance of', () => {
  3. class Person {
  4. }
  5. class Student extends Person {
  6. }
  7. class Something {
  8. }
  9. Something.prototype = new Student()
  10. const s = new Something()
  11. Student.prototype = s.__proto__
  12. expect(s instanceof Student).toEqual(true)
  13. expect(s instanceof Person).toEqual(true)
  14. })
  15. })