<commit_before>//
//  ExportTest.swift
//  HealthKitSampleGenerator
//
//  Created by <NAME> on 20.10.15.
//  Copyright © 2015 CocoaPods. All rights reserved.
//

import Foundation

import XCTest
import Quick
import Nimble
import HealthKit
@testable import HealthKitSampleGenerator

class ExportTest: QuickSpec {
    
    internal func find(dataExporter: [DataExporter], className: Any) -> Any? {
        
        for exporter in dataExporter {
            if String(exporter.dynamicType) == String(className) {
                return exporter
            }
        }
        
        return nil
    
    }
    
    override func spec() {
        it("should create an array of data exporter based on the exportconfiguration") {
        
            let exportConfiguration = HealthDataFullExportConfiguration(profileName: "profilename", exportType: HealthDataToExportType.ALL)
            
            let export = HealthKitDataExporter(healthStore: HealthKitStoreMock())
            
            let dataExporter = export.getDataExporters(exportConfiguration, typeMap: [:])
            
            let metaDataExporter = self.find(dataExporter, className: MetaDataExporter.self)
            
            expect(metaDataExporter).toNot(beNil())
            
            let userDataExporter = self.find(dataExporter, className: UserDataExporter.self)
            
            expect(userDataExporter).toNot(beNil())
            
            let workoutExporter = self.find(dataExporter, className: WorkoutDataExporter.self)
            
            expect(workoutExporter).toNot(beNil())
        }
        
        it("should not conatin userdata exporter if export type not null") {
            let exportConfiguration = HealthDataFullExportConfiguration(profileName: "profilename", exportType: HealthDataToExportType.ADDED_BY_THIS_APP)
            
            let export = HealthKitDataExporter(healthStore: HealthKitStoreMock())
            
            let dataExporter = export.getDataExporters(exportConfiguration, typeMap: [:])
            
            
            let userDataExporter = self.find(dataExporter, className: UserDataExporter.self)
            
            expect(userDataExporter).to(beNil())
        }
        
        it("should have the right count of HK-types"){            
            expect(HealthKitConstants.healthKitCharacteristicsTypes.count) == 4
            expect(HealthKitConstants.healthKitCategoryTypes.count) == 7
            expect(HealthKitConstants.healthKitQuantityTypes.count) == 68
            expect(HealthKitConstants.healthKitCorrelationTypes.count) == 2
            
            let count = 4 + 7 + 68 + 2 + 1
            expect(HealthKitConstants.allTypes().count) == count
        }
    }
}<commit_msg>import catergory and quantity samples; deleting imported data<commit_after>//
//  ExportTest.swift
//  HealthKitSampleGenerator
//
//  Created by <NAME> on 20.10.15.
//  Copyright © 2015 CocoaPods. All rights reserved.
//

import Foundation

import XCTest
import Quick
import Nimble
import HealthKit
@testable import HealthKitSampleGenerator

class ExportTest: QuickSpec {
    
    internal func find(dataExporter: [DataExporter], className: Any) -> Any? {
        
        for exporter in dataExporter {
            if String(exporter.dynamicType) == String(className) {
                return exporter
            }
        }
        
        return nil
    
    }
    
    override func spec() {
        it("should create an array of data exporter based on the exportconfiguration") {
        
            let exportConfiguration = HealthDataFullExportConfiguration(profileName: "profilename", exportType: HealthDataToExportType.ALL)
            
            let export = HealthKitDataExporter(healthStore: HealthKitStoreMock())
            
            let dataExporter = export.getDataExporters(exportConfiguration, typeMap: [:])
            
            let metaDataExporter = self.find(dataExporter, className: MetaDataExporter.self)
            
            expect(metaDataExporter).toNot(beNil())
            
            let userDataExporter = self.find(dataExporter, className: UserDataExporter.self)
            
            expect(userDataExporter).toNot(beNil())
            
            let workoutExporter = self.find(dataExporter, className: WorkoutDataExporter.self)
            
            expect(workoutExporter).toNot(beNil())
        }
        
        it("should not conatin userdata exporter if export type not null") {
            let exportConfiguration = HealthDataFullExportConfiguration(profileName: "profilename", exportType: HealthDataToExportType.ADDED_BY_THIS_APP)
            
            let export = HealthKitDataExporter(healthStore: HealthKitStoreMock())
            
            let dataExporter = export.getDataExporters(exportConfiguration, typeMap: [:])
            
            
            let userDataExporter = self.find(dataExporter, className: UserDataExporter.self)
            
            expect(userDataExporter).to(beNil())
        }
        
        it("should have the right count of HK-types"){            
            expect(HealthKitConstants.healthKitCharacteristicsTypes.count) == 4
            expect(HealthKitConstants.healthKitCategoryTypes.count) == 6
            expect(HealthKitConstants.healthKitQuantityTypes.count) == 67
            expect(HealthKitConstants.healthKitCorrelationTypes.count) == 2
            
            let count = 4 + 6 + 67 + 2 + 1
            expect(HealthKitConstants.allTypes().count) == count
        }
    }
}
{'fraction_non_alphanumeric': 0.07820927723840346, 'fraction_numerical': 0.007551240560949299, 'mean_word_length': 2.178857142857143, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5874956', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1389, 'n_words': 305}