var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import chaiAsPromised from 'chai-as-promised';
import { getCurrentTimeInHighPrecision } from '../../src/utils/time.js';
import { Jws } from '../../src/utils/jws.js';
import { SnapshotScopeType } from '../../src/types/snapshots-types.js';
import { SnapshotsCreate } from '../../src/interfaces/snapshots-create.js';
import { TestDataGenerator } from '../utils/test-data-generator.js';
import chai, { expect } from 'chai';
chai.use(chaiAsPromised);
describe('SnapshotsCreate', () => {
    if (process.env.TESTSOFF === 'true') {
        return;
    }
    describe('create()', () => {
        it('should be able to create a SnapshotCreate message', () => __awaiter(void 0, void 0, void 0, function* () {
            const alice = yield TestDataGenerator.generatePersona();
            const currentTime = getCurrentTimeInHighPrecision();
            const definition = {
                scope: {
                    type: SnapshotScopeType.Permissions,
                    permissionsGrantId: yield TestDataGenerator.randomCborSha256Cid()
                },
                messageCids: [
                    yield TestDataGenerator.randomCborSha256Cid(),
                    yield TestDataGenerator.randomCborSha256Cid(),
                    yield TestDataGenerator.randomCborSha256Cid()
                ]
            };
            const snapshotsCreate = yield SnapshotsCreate.create({
                messageTimestamp: currentTime,
                definition,
                authorizationSignatureInput: Jws.createSignatureInput(alice),
            });
            expect(snapshotsCreate.message.descriptor.messageTimestamp).to.equal(currentTime);
        }));
    });
});
//# sourceMappingURL=snapshots-create.spec.js.map