import {ID} from "../../../source/types/id.mjs";
import {expect} from "chai"
import {initJSDOM} from "../../util/jsdom.mjs";

describe('ID', function () {

    before(function (done) {

        let promises = []
        if(!globalThis['crypto']) {
            promises.push(import("@peculiar/webcrypto").then(m => {
                globalThis['crypto'] = new m.Crypto();
                return true;
            }))
        }


        Promise.all(promises).then(() => {
            done()
        });

    });    
    
    describe('.toString()', function () {
        let id = new ID()
        let result = id.toString();

        it('should return a string', function () {
            expect(result).is.a('string')
        });
        
        it('should return a string', function () {
            expect(new ID('text1425id').toString()).is.equal('text1425id1')
            expect(new ID('text1425id').toString()).is.equal('text1425id2')
            expect(new ID('text1425id').toString()).is.equal('text1425id3')
        });

    });

});

