<commit_before>//
//  StreamCellItemParserSpec.swift
//  Ello
//
//  Created by Sean on 2/5/15.
//  Copyright (c) 2015 Ello. All rights reserved.
//

import Ello
import Quick
import Nimble
import Moya


class StreamCellItemParserSpec: QuickSpec {

    var parser: StreamCellItemParser!

    override func spec() {

        describe("-streamCellItems:") {

            beforeEach {
                self.parser = StreamCellItemParser()
            }

            it("returns an empty array if an empty array of Posts is passed in") {
                let posts = [Post]()
                expect(self.parser.parse(posts, streamKind: .Friend).count) == 0
            }

            it("returns an empty array if an empty array of Comments is passed in") {
                let comments = [Comment]()
                expect(self.parser.parse(comments, streamKind: .Friend).count) == 0
            }

            it("returns an array with the proper count of stream cell items when parsing friends.json's posts") {
                var loadedPosts = [StreamCellItem]()
                StreamService().loadStream(ElloAPI.FriendStream, streamKind: nil,
                    success: { (jsonables, responseConfig) in
                        loadedPosts = self.parser.parse(jsonables, streamKind: .Friend)
                    },
                    failure: nil
                )
                expect(loadedPosts.count) == 8
            }

            it("returns an empty array if an empty array of Activities is passed in") {
                let activities = [Notification]()<commit_msg>Fix one spec due to not having comments come back<commit_after>//
//  StreamCellItemParserSpec.swift
//  Ello
//
//  Created by Sean on 2/5/15.
//  Copyright (c) 2015 Ello. All rights reserved.
//

import Ello
import Quick
import Nimble
import Moya


class StreamCellItemParserSpec: QuickSpec {

    var parser: StreamCellItemParser!

    override func spec() {

        describe("-streamCellItems:") {

            beforeEach {
                self.parser = StreamCellItemParser()
            }

            it("returns an empty array if an empty array of Posts is passed in") {
                let posts = [Post]()
                expect(self.parser.parse(posts, streamKind: .Friend).count) == 0
            }

            it("returns an empty array if an empty array of Comments is passed in") {
                let comments = [Comment]()
                expect(self.parser.parse(comments, streamKind: .Friend).count) == 0
            }

            it("returns an array with the proper count of stream cell items when parsing friends.json's posts") {
                var loadedPosts = [StreamCellItem]()
                StreamService().loadStream(ElloAPI.FriendStream, streamKind: nil,
                    success: { (jsonables, responseConfig) in
                        loadedPosts = self.parser.parse(jsonables, streamKind: .Friend)
                    },
                    failure: nil
                )
                expect(loadedPosts.count) == 6
            }

            it("returns an empty array if an empty array of Activities is passed in") {
                let activities = [Notification]()
{'fraction_non_alphanumeric': 0.090282131661442, 'fraction_numerical': 0.006896551724137931, 'mean_word_length': 1.7556131260794474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6537090', 'n_tokens_mistral': 850, 'n_tokens_neox': 764, 'n_words': 258}