Example #1
0
    it('returns false for a non-featured collection', () => {
      const featuredCollections = [
        { slug: 'privacy-matters', userId: 4757633 },
      ];

      const collection = createCollection({ slug: 'another-collection' });

      expect(isFeaturedCollection(collection, { featuredCollections })).toEqual(
        false,
      );
    });
Example #2
0
    it('returns true for a featured collection', () => {
      const slug = 'privacy-matters';
      const userId = 4757633;

      const featuredCollections = [{ slug, userId }];

      const collection = createCollection({ slug, authorId: userId });

      expect(isFeaturedCollection(collection, { featuredCollections })).toEqual(
        true,
      );
    });
    it('returns true for a featured collection', () => {
      const slug = 'privacy-matters';
      const username = '******';

      const featuredCollections = [{ slug, username }];

      const collection = createCollection({ slug, authorUsername: username });

      expect(isFeaturedCollection(collection, { featuredCollections })).toEqual(
        true,
      );
    });
Example #4
0
    it('returns false for a matching author, wrong slug', () => {
      const userId = 4757633;

      const featuredCollections = [{ slug: 'privacy-matters', userId }];

      const collection = createCollection({
        slug: 'another-collection',
        authorId: userId,
      });

      expect(isFeaturedCollection(collection, { featuredCollections })).toEqual(
        false,
      );
    });
Example #5
0
    it('returns false for a matching slug, wrong author', () => {
      const slug = 'privacy-matters';

      const featuredCollections = [{ slug, userId: 4757633 }];

      const collection = createCollection({
        slug,
        authorId: 12,
      });

      expect(isFeaturedCollection(collection, { featuredCollections })).toEqual(
        false,
      );
    });
    it('returns false for a matching author, wrong slug', () => {
      const username = '******';

      const featuredCollections = [{ slug: 'privacy-matters', username }];

      const collection = createCollection({
        slug: 'another-collection',
        authorUsername: username,
      });

      expect(isFeaturedCollection(collection, { featuredCollections })).toEqual(
        false,
      );
    });
    it('returns false for a matching slug, wrong author', () => {
      const slug = 'privacy-matters';

      const featuredCollections = [{ slug, username: '******' }];

      const collection = createCollection({
        slug,
        authorUsername: '******',
      });

      expect(isFeaturedCollection(collection, { featuredCollections })).toEqual(
        false,
      );
    });
Example #8
0
    it('returns true for one of many featured collections', () => {
      const slug = 'privacy-matters';
      const userId = 4757633;

      const featuredCollections = [
        { slug: 'first', userId: 123 },
        { slug: 'second', userId: 456 },
        { slug, userId },
      ];

      const collection = createCollection({ slug, authorId: userId });

      expect(isFeaturedCollection(collection, { featuredCollections })).toEqual(
        true,
      );
    });
    it('returns true for one of many featured collections', () => {
      const slug = 'privacy-matters';
      const username = '******';

      const featuredCollections = [
        { slug: 'first', username: '******' },
        { slug: 'second', username: '******' },
        { slug, username },
      ];

      const collection = createCollection({ slug, authorUsername: username });

      expect(isFeaturedCollection(collection, { featuredCollections })).toEqual(
        true,
      );
    });