-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#34 - aliases have the same weight as the basename
- Loading branch information
Showing
6 changed files
with
72 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { CachedMetadata } from 'obsidian' | ||
import { getAliasesFromMetadata } from '../utils' | ||
|
||
describe('Utils', () => { | ||
describe('getAliasesFromMetadata', () => { | ||
it('should return an empty string if no metadata is provided', () => { | ||
// Act | ||
const actual = getAliasesFromMetadata(null) | ||
// Assert | ||
expect(actual).toBe('') | ||
}) | ||
it('should return an empty string if no aliases are provided', () => { | ||
// Arrange | ||
const metadata = {} as CachedMetadata | ||
// Act | ||
const actual = getAliasesFromMetadata(metadata) | ||
// Assert | ||
expect(actual).toBe('') | ||
}) | ||
it('should join aliases with a comma', () => { | ||
// Arrange | ||
const metadata = { | ||
frontmatter: { aliases: ['foo', 'bar'] }, | ||
} as CachedMetadata | ||
// Act | ||
const actual = getAliasesFromMetadata(metadata) | ||
// Assert | ||
expect(actual).toBe('foo, bar') | ||
}) | ||
it('should return a single alias if only one is provided', () => { | ||
// Arrange | ||
const metadata = { | ||
frontmatter: { aliases: 'foo, bar' }, | ||
} as CachedMetadata | ||
// Act | ||
const actual = getAliasesFromMetadata(metadata) | ||
// Assert | ||
expect(actual).toBe('foo, bar') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters