{"size": 1281, "ext": "js", "max_stars_repo_path": "test/api/util/unique.js", "max_stars_repo_name": "gregorschatz/DataTablesSrc", "max_stars_repo_stars_event_min_datetime": "2015-02-17T10:40:21.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-28T12:13:37.000Z", "max_issues_repo_path": "test/api/util/unique.js", "max_issues_repo_name": "gregorschatz/DataTablesSrc", "max_issues_repo_issues_event_min_datetime": "2015-01-12T00:21:33.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-14T09:58:51.000Z", "max_forks_repo_path": "test/api/util/unique.js", "max_forks_repo_name": "gregorschatz/DataTablesSrc", "max_forks_repo_forks_event_min_datetime": "2015-01-17T03:59:33.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T18:27:01.000Z"}
{"max_stars_count": 338, "max_issues_count": 173, "max_forks_count": 439, "avg_line_length": 23.7222222222, "max_line_length": 67, "alphanum_fraction": 0.5909445746}
describe('unique()', function() {
	let table;

	dt.libs({
		js: ['jquery', 'datatables'],
		css: ['datatables']
	});

	describe('Check the defaults', function() {
		dt.html('basic');
		it('Exists and is a function', function() {
			table = $('#example').DataTable();
			expect(typeof table.unique).toBe('function');
		});
		it('Returns API instance', function() {
			expect(table.unique() instanceof $.fn.dataTable.Api).toBe(true);
		});
	});

	describe('Functional tests', function() {
		dt.html('basic');
		it('Check uniqueness on Strings', function() {
			table = $('#example').DataTable();
			var data = table
				.column(2)
				.data()
				.unique();
			expect(data.count()).toBe(7);

			expect(data[0]).toBe('Tokyo');
			expect(data[1]).toBe('London');
			expect(data[2]).toBe('San Francisco');
			expect(data[3]).toBe('New York');
			expect(data[4]).toBe('Edinburgh');
			expect(data[5]).toBe('Sidney');
			expect(data[6]).toBe('Singapore');
		});
		it('Get unique data from numerical column', function() {
			var data = table
				.column(3)
				.data()
				.unique();
			expect(data.count()).toBe(33);
		});
		it('Get unique data from date column', function() {
			var data = table
				.column(4)
				.data()
				.unique();
			expect(data.count()).toBe(57);
		});
	});
});
