2021-03-10 11:37:35 +00:00
|
|
|
import {
|
|
|
|
writeDictionaryInfo,
|
|
|
|
readDictionaryInfo,
|
|
|
|
writeDictionary,
|
|
|
|
readDictionary,
|
|
|
|
} from "./protobuf";
|
|
|
|
import * as T from "../types";
|
|
|
|
|
|
|
|
const sampleDictionaryInfo: T.DictionaryInfo = {
|
|
|
|
title: "Sample Dictionary",
|
|
|
|
license: "none",
|
|
|
|
url: "https://www.example.com",
|
|
|
|
infoUrl: "https://www.example.com",
|
|
|
|
release: 1,
|
|
|
|
numberOfEntries: 5,
|
|
|
|
};
|
|
|
|
|
|
|
|
const sampleDictionary: T.Dictionary = {
|
|
|
|
info: sampleDictionaryInfo,
|
|
|
|
entries: [
|
2021-07-04 18:55:43 +00:00
|
|
|
{"i":616,"ts":1527813108,"p":"اظهار","f":"izháar","g":"izhaar","e":"expression, statement, declaration","c":"n. m.","ec":"cool"},
|
2021-03-10 11:37:35 +00:00
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
test("should encode and decode", () => {
|
|
|
|
expect(readDictionaryInfo(writeDictionaryInfo(sampleDictionaryInfo))).toEqual(sampleDictionaryInfo);
|
|
|
|
expect(readDictionary(writeDictionary(sampleDictionary))).toEqual(sampleDictionary);
|
|
|
|
});
|