@book000/pixivts
Version:
pixiv Unofficial API Library for TypeScript
117 lines • 5.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const options_1 = require("./options");
describe('options', () => {
describe('SearchTargetCheck', () => {
let check;
beforeEach(() => {
check = new options_1.SearchTargetCheck();
});
it('should validate valid SearchTarget values', () => {
expect(check.is(options_1.SearchTarget.PARTIAL_MATCH_FOR_TAGS)).toBe(true);
expect(check.is(options_1.SearchTarget.EXACT_MATCH_FOR_TAGS)).toBe(true);
expect(check.is(options_1.SearchTarget.TITLE_AND_CAPTION)).toBe(true);
expect(check.is(options_1.SearchTarget.KEYWORD)).toBe(true);
});
it('should invalidate invalid SearchTarget values', () => {
expect(check.is('invalid')).toBe(false);
expect(check.is('')).toBe(false);
expect(check.is(undefined)).toBe(false);
expect(check.is(null)).toBe(false);
});
});
describe('SearchSortCheck', () => {
let check;
beforeEach(() => {
check = new options_1.SearchSortCheck();
});
it('should validate valid SearchSort values', () => {
expect(check.is(options_1.SearchSort.DATE_DESC)).toBe(true);
expect(check.is(options_1.SearchSort.DATE_ASC)).toBe(true);
expect(check.is(options_1.SearchSort.POPULAR_DESC)).toBe(true);
});
it('should invalidate invalid SearchSort values', () => {
expect(check.is('invalid')).toBe(false);
expect(check.is('')).toBe(false);
expect(check.is(undefined)).toBe(false);
expect(check.is(null)).toBe(false);
});
});
describe('SearchIllustDurationCheck', () => {
let check;
beforeEach(() => {
check = new options_1.SearchIllustDurationCheck();
});
it('should validate valid SearchIllustDuration values', () => {
expect(check.is(options_1.SearchIllustDuration.WITHIN_LAST_DAY)).toBe(true);
expect(check.is(options_1.SearchIllustDuration.WITHIN_LAST_WEEK)).toBe(true);
expect(check.is(options_1.SearchIllustDuration.WITHIN_LAST_MONTH)).toBe(true);
});
it('should invalidate invalid SearchIllustDuration values', () => {
expect(check.is('invalid')).toBe(false);
expect(check.is('')).toBe(false);
expect(check.is(undefined)).toBe(false);
expect(check.is(null)).toBe(false);
});
});
describe('OSFilterCheck', () => {
let check;
beforeEach(() => {
check = new options_1.OSFilterCheck();
});
it('should validate valid OSFilter values', () => {
expect(check.is(options_1.OSFilter.FOR_IOS)).toBe(true);
expect(check.is(options_1.OSFilter.FOR_ANDROID)).toBe(true);
});
it('should invalidate invalid OSFilter values', () => {
expect(check.is('invalid')).toBe(false);
expect(check.is('')).toBe(false);
expect(check.is(undefined)).toBe(false);
expect(check.is(null)).toBe(false);
});
});
describe('BookmarkRestrictCheck', () => {
let check;
beforeEach(() => {
check = new options_1.BookmarkRestrictCheck();
});
it('should validate valid BookmarkRestrict values', () => {
expect(check.is(options_1.BookmarkRestrict.PUBLIC)).toBe(true);
expect(check.is(options_1.BookmarkRestrict.PRIVATE)).toBe(true);
});
it('should invalidate invalid BookmarkRestrict values', () => {
expect(check.is('invalid')).toBe(false);
expect(check.is('')).toBe(false);
expect(check.is(undefined)).toBe(false);
expect(check.is(null)).toBe(false);
});
});
describe('RankingModeCheck', () => {
let check;
beforeEach(() => {
check = new options_1.RankingModeCheck();
});
it('should validate valid RankingMode values', () => {
expect(check.is(options_1.RankingMode.DAY)).toBe(true);
expect(check.is(options_1.RankingMode.DAY_MALE)).toBe(true);
expect(check.is(options_1.RankingMode.DAY_FEMALE)).toBe(true);
expect(check.is(options_1.RankingMode.WEEK_ORIGINAL)).toBe(true);
expect(check.is(options_1.RankingMode.WEEK_ROOKIE)).toBe(true);
expect(check.is(options_1.RankingMode.WEEK)).toBe(true);
expect(check.is(options_1.RankingMode.MONTH)).toBe(true);
expect(check.is(options_1.RankingMode.DAY_AI)).toBe(true);
expect(check.is(options_1.RankingMode.DAY_R18)).toBe(true);
expect(check.is(options_1.RankingMode.WEEK_R18)).toBe(true);
expect(check.is(options_1.RankingMode.DAY_MALE_R18)).toBe(true);
expect(check.is(options_1.RankingMode.DAY_FEMALE_R18)).toBe(true);
expect(check.is(options_1.RankingMode.DAY_R18_AI)).toBe(true);
});
it('should invalidate invalid RankingMode values', () => {
expect(check.is('invalid')).toBe(false);
expect(check.is('')).toBe(false);
expect(check.is(undefined)).toBe(false);
expect(check.is(null)).toBe(false);
});
});
});
//# sourceMappingURL=options.test.js.map