-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from AtlasTheBot/dev
Dev 2.4.0
- Loading branch information
Showing
11 changed files
with
970 additions
and
2,381 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,47 +1,47 @@ | ||
import path from 'path'; | ||
import { BooruClass, BooruError, resolveSite, sites } from '../src'; | ||
import Site from '../src/structures/Site'; | ||
|
||
let site: string; | ||
|
||
beforeEach(() => { | ||
site = 'db'; | ||
}); | ||
|
||
describe('Check resolveSite', () => { | ||
it('should resolve alias to host', () => { | ||
expect(resolveSite(site)).toBe('danbooru.donmai.us'); | ||
}); | ||
}); | ||
|
||
describe('check BooruError', () => { | ||
it('should resolve to a BooruError', () => { | ||
const booruError = new BooruError(); | ||
expect(booruError.name).toBe('BooruError'); | ||
expect(booruError.stack).toContain(path.basename(__filename)); | ||
}); | ||
}); | ||
|
||
describe('check BooruClass', () => { | ||
it('should resolve to a BooruClass', () => { | ||
const SiteData: Site = { | ||
aliases: ['sb', 'safe', 'safebooru'], | ||
api: {search: '/index.php?page=dapi&s=post&q=index&json=1&', postView: '/index.php?page=post&s=view&json=1&id='}, | ||
domain: 'safebooru.org', | ||
nsfw: false, | ||
random: false, | ||
paginate: 'pid', | ||
}; | ||
const booruClass = new BooruClass(SiteData); | ||
|
||
expect(booruClass.domain).toBe('safebooru.org'); | ||
expect(booruClass.site).toMatchObject(SiteData); | ||
}); | ||
}); | ||
|
||
describe('check sites', () => { | ||
it('should support 16 sites', () => { | ||
const map = sites; | ||
expect(Object.keys(map)).toHaveLength(16); | ||
}); | ||
}); | ||
import path from 'path' | ||
import { BooruClass, BooruError, resolveSite, sites } from '../src' | ||
import Site from '../src/structures/Site' | ||
|
||
let site: string | ||
|
||
beforeEach(() => { | ||
site = 'db' | ||
}) | ||
|
||
describe('Check resolveSite', () => { | ||
it('should resolve alias to host', () => { | ||
expect(resolveSite(site)).toBe('danbooru.donmai.us') | ||
}) | ||
}) | ||
|
||
describe('check BooruError', () => { | ||
it('should resolve to a BooruError', () => { | ||
const booruError = new BooruError() | ||
expect(booruError.name).toBe('BooruError') | ||
expect(booruError.stack).toContain(path.basename(__filename)) | ||
}) | ||
}) | ||
|
||
describe('check BooruClass', () => { | ||
it('should resolve to a BooruClass', () => { | ||
const SiteData: Site = { | ||
aliases: ['sb', 'safe', 'safebooru'], | ||
api: {search: '/index.php?page=dapi&s=post&q=index&json=1&', postView: '/index.php?page=post&s=view&json=1&id='}, | ||
domain: 'safebooru.org', | ||
nsfw: false, | ||
random: false, | ||
paginate: 'pid', | ||
} | ||
const booruClass = new BooruClass(SiteData) | ||
|
||
expect(booruClass.domain).toBe('safebooru.org') | ||
expect(booruClass.site).toMatchObject(SiteData) | ||
}) | ||
}) | ||
|
||
describe('check sites', () => { | ||
it('should support 15 sites', () => { | ||
const map = sites | ||
expect(Object.keys(map)).toHaveLength(15) | ||
}) | ||
}) |