<commit_before>describe('#Layer', function() {

    var container;
    var map;
    var tile;
    var center = new Z.Coordinate(118.846825, 32.046534);
    var context = {
        map:map
    };

    beforeEach(function() {
       var setups = commonSetupMap(center);
        container = setups.container;
        map = setups.map;
        context.map = map;
    });

    afterEach(function() {
        removeContainer(container)
    });

    describe('change order of layers', function() {

        it('bring a layer to front', function() {
            var layer1 = new maptalks.TileLayer('1');
            var layer2 = new maptalks.VectorLayer('2');
            var layer3 = new maptalks.VectorLayer('3');

            map.addLayer([layer1, layer2, layer3]);

            expect(map.getLayers()).to.be.eql([layer1, layer2, layer3]);

            layer1.bringToFront();
            expect(map.getLayers()).to.be.eql([layer2, layer3, layer1]);

            layer2.bringToFront();
            expect(map.getLayers()).to.be.eql([layer3, layer1, layer2]);

            layer3.bringToFront();<commit_msg>add spec for layer id<commit_after>describe('#Layer', function() {

    var container;
    var map;
    var tile;
    var center = new Z.Coordinate(118.846825, 32.046534);
    var context = {
        map:map
    };

    beforeEach(function() {
       var setups = commonSetupMap(center);
        container = setups.container;
        map = setups.map;
        context.map = map;
    });

    afterEach(function() {
        removeContainer(container)
    });

    describe('id methods', function() {
        it('id will be converted to string', function() {
            var layer1 = new maptalks.TileLayer(1);
            expect(layer1.getId()).to.be.eql('1');
        });

        it('id can be null or undefined', function() {
            var layer1 = new maptalks.TileLayer(null);
            expect(layer1.getId() === null).to.be.ok();
            layer1.setId(undefined);
            expect(layer1.getId() === undefined).to.be.ok();
        });

        it('null id can\'t be added to map', function () {
            var layer1 = new maptalks.TileLayer(null);
            try {
                map.addLayer(layer1);
                expect(false).to.be.ok();
            } catch (err) {

            }

        });
    });

    describe('change order of layers', function() {

        it('bring a layer to front', function() {
            var layer1 = new maptalks.TileLayer('1');
            var layer2 = new maptalks.VectorLayer('2');
            var layer3 = new maptalks.VectorLayer('3');

            map.addLayer([layer1, layer2, layer3]);

            expect(map.getLayers()).to.be.eql([layer1, layer2, layer3]);

            layer1.bringToFront();
            expect(map.getLayers()).to.be.eql([layer2, layer3, layer1]);

            layer2.bringToFront();
            expect(map.getLayers()).to.be.eql([layer3, layer1, layer2]);

            layer3.bringToFront();
{'fraction_non_alphanumeric': 0.14516129032258066, 'fraction_numerical': 0.02889784946236559, 'mean_word_length': 2.0408580183861083, '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': '4591092', 'n_tokens_mistral': 949, 'n_tokens_neox': 888, 'n_words': 183}