|
| 1 | +/** |
| 2 | + * This source file is part of the Swift.org open source project |
| 3 | + * |
| 4 | + * Copyright (c) 2021 Apple Inc. and the Swift project authors |
| 5 | + * Licensed under Apache License v2.0 with Runtime Library Exception |
| 6 | + * |
| 7 | + * See https://swift.org/LICENSE.txt for license information |
| 8 | + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors |
| 9 | +*/ |
| 10 | +import { isParentSymbolKind } from 'docc-render/utils/symbols'; |
| 11 | +import SymbolKind from 'docc-render/constants/SymbolKind'; |
| 12 | + |
| 13 | +describe('isParentSymbolKind', () => { |
| 14 | + it('returns true for kind "class"', () => { |
| 15 | + expect(isParentSymbolKind(SymbolKind.class)).toBe(true); |
| 16 | + }); |
| 17 | + |
| 18 | + it('returns true for kind "enum"', () => { |
| 19 | + expect(isParentSymbolKind(SymbolKind.enum)).toBe(true); |
| 20 | + }); |
| 21 | + |
| 22 | + it('returns true for kind "protocol"', () => { |
| 23 | + expect(isParentSymbolKind(SymbolKind.protocol)).toBe(true); |
| 24 | + }); |
| 25 | + |
| 26 | + it('returns true for kind "struct"', () => { |
| 27 | + expect(isParentSymbolKind(SymbolKind.struct)).toBe(true); |
| 28 | + }); |
| 29 | + |
| 30 | + it('returns true for kind "uid"', () => { |
| 31 | + expect(isParentSymbolKind(SymbolKind.uid)).toBe(true); |
| 32 | + }); |
| 33 | + |
| 34 | + it('returns false for other kind values', () => { |
| 35 | + expect(isParentSymbolKind(SymbolKind.unknown)).toBe(false); |
| 36 | + expect(isParentSymbolKind('clm')).toBe(false); |
| 37 | + expect(isParentSymbolKind('instm')).toBe(false); |
| 38 | + expect(isParentSymbolKind('method')).toBe(false); |
| 39 | + expect(isParentSymbolKind('initializer')).toBe(false); |
| 40 | + expect(isParentSymbolKind('func')).toBe(false); |
| 41 | + expect(isParentSymbolKind('function')).toBe(false); |
| 42 | + expect(isParentSymbolKind('property')).toBe(false); |
| 43 | + expect(isParentSymbolKind('')).toBe(false); |
| 44 | + }); |
| 45 | +}); |
0 commit comments