From bc4fc9eb5693e260c0af073b377befb9b173e1f9 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Wed, 30 Jun 2021 17:54:28 +0200 Subject: [PATCH 1/5] removed generated test files --- .../1.0.3/doi/append/upserting.test.js | 49 ----------------- .../1.0.3/doi/overwrite/upserting.test.js | 49 ----------------- .../upserting/1.0.3/errors/upserting.test.js | 55 ------------------- .../1.1.0/doi/append/upserting.test.js | 49 ----------------- .../1.1.0/doi/overwrite/upserting.test.js | 49 ----------------- .../identifiers_0/append/upserting.test.js | 49 ----------------- .../identifiers_0/overwrite/upserting.test.js | 49 ----------------- .../append/upserting.test.js | 49 ----------------- .../identifiers-not-array/upserting.test.js | 55 ------------------- .../out-of-range-index-1/upserting.test.js | 55 ------------------- .../out-of-range-index-99/upserting.test.js | 55 ------------------- .../overwrite/upserting.test.js | 49 ----------------- .../1.2.0/doi/append/upserting.test.js | 49 ----------------- .../1.2.0/doi/overwrite/upserting.test.js | 49 ----------------- .../identifiers_0/append/upserting.test.js | 49 ----------------- .../identifiers_0/overwrite/upserting.test.js | 49 ----------------- .../append/upserting.test.js | 49 ----------------- .../identifiers-not-array/upserting.test.js | 55 ------------------- .../out-of-range-index-1/upserting.test.js | 55 ------------------- .../out-of-range-index-99/upserting.test.js | 55 ------------------- .../overwrite/upserting.test.js | 49 ----------------- .../errors/cff-no-object/upserting.test.js | 55 ------------------- .../errors/cff-not-yaml/upserting.test.js | 55 ------------------- .../invalid-upsert-location/upserting.test.js | 55 ------------------- .../errors/no-cff-file/upserting.test.js | 48 ---------------- .../errors/no-cff-version/upserting.test.js | 55 ------------------- 26 files changed, 1339 deletions(-) delete mode 100644 tests/upserting/1.0.3/doi/append/upserting.test.js delete mode 100644 tests/upserting/1.0.3/doi/overwrite/upserting.test.js delete mode 100644 tests/upserting/1.0.3/errors/upserting.test.js delete mode 100644 tests/upserting/1.1.0/doi/append/upserting.test.js delete mode 100644 tests/upserting/1.1.0/doi/overwrite/upserting.test.js delete mode 100644 tests/upserting/1.1.0/identifiers_0/append/upserting.test.js delete mode 100644 tests/upserting/1.1.0/identifiers_0/overwrite/upserting.test.js delete mode 100644 tests/upserting/1.1.0/identifiers_index/append/upserting.test.js delete mode 100644 tests/upserting/1.1.0/identifiers_index/errors/identifiers-not-array/upserting.test.js delete mode 100644 tests/upserting/1.1.0/identifiers_index/errors/out-of-range-index-1/upserting.test.js delete mode 100644 tests/upserting/1.1.0/identifiers_index/errors/out-of-range-index-99/upserting.test.js delete mode 100644 tests/upserting/1.1.0/identifiers_index/overwrite/upserting.test.js delete mode 100644 tests/upserting/1.2.0/doi/append/upserting.test.js delete mode 100644 tests/upserting/1.2.0/doi/overwrite/upserting.test.js delete mode 100644 tests/upserting/1.2.0/identifiers_0/append/upserting.test.js delete mode 100644 tests/upserting/1.2.0/identifiers_0/overwrite/upserting.test.js delete mode 100644 tests/upserting/1.2.0/identifiers_index/append/upserting.test.js delete mode 100644 tests/upserting/1.2.0/identifiers_index/errors/identifiers-not-array/upserting.test.js delete mode 100644 tests/upserting/1.2.0/identifiers_index/errors/out-of-range-index-1/upserting.test.js delete mode 100644 tests/upserting/1.2.0/identifiers_index/errors/out-of-range-index-99/upserting.test.js delete mode 100644 tests/upserting/1.2.0/identifiers_index/overwrite/upserting.test.js delete mode 100644 tests/upserting/errors/cff-no-object/upserting.test.js delete mode 100644 tests/upserting/errors/cff-not-yaml/upserting.test.js delete mode 100644 tests/upserting/errors/invalid-upsert-location/upserting.test.js delete mode 100644 tests/upserting/errors/no-cff-file/upserting.test.js delete mode 100644 tests/upserting/errors/no-cff-version/upserting.test.js diff --git a/tests/upserting/1.0.3/doi/append/upserting.test.js b/tests/upserting/1.0.3/doi/append/upserting.test.js deleted file mode 100644 index 987e1883..00000000 --- a/tests/upserting/1.0.3/doi/append/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'doi'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.0.3/doi/overwrite/upserting.test.js b/tests/upserting/1.0.3/doi/overwrite/upserting.test.js deleted file mode 100644 index 987e1883..00000000 --- a/tests/upserting/1.0.3/doi/overwrite/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'doi'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.0.3/errors/upserting.test.js b/tests/upserting/1.0.3/errors/upserting.test.js deleted file mode 100644 index 017dd920..00000000 --- a/tests/upserting/1.0.3/errors/upserting.test.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers[0]'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('Your CITATION.cff file does not support key \'identifiers\'. Consider updating its \'cff-version\' value.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.1.0/doi/append/upserting.test.js b/tests/upserting/1.1.0/doi/append/upserting.test.js deleted file mode 100644 index 987e1883..00000000 --- a/tests/upserting/1.1.0/doi/append/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'doi'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.1.0/doi/overwrite/upserting.test.js b/tests/upserting/1.1.0/doi/overwrite/upserting.test.js deleted file mode 100644 index 987e1883..00000000 --- a/tests/upserting/1.1.0/doi/overwrite/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'doi'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.1.0/identifiers_0/append/upserting.test.js b/tests/upserting/1.1.0/identifiers_0/append/upserting.test.js deleted file mode 100644 index 6d94fa1c..00000000 --- a/tests/upserting/1.1.0/identifiers_0/append/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.1.0/identifiers_0/overwrite/upserting.test.js b/tests/upserting/1.1.0/identifiers_0/overwrite/upserting.test.js deleted file mode 100644 index 6d94fa1c..00000000 --- a/tests/upserting/1.1.0/identifiers_0/overwrite/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.1.0/identifiers_index/append/upserting.test.js b/tests/upserting/1.1.0/identifiers_index/append/upserting.test.js deleted file mode 100644 index 0d9fc1ef..00000000 --- a/tests/upserting/1.1.0/identifiers_index/append/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers[0]'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.1.0/identifiers_index/errors/identifiers-not-array/upserting.test.js b/tests/upserting/1.1.0/identifiers_index/errors/identifiers-not-array/upserting.test.js deleted file mode 100644 index 52fea4d0..00000000 --- a/tests/upserting/1.1.0/identifiers_index/errors/identifiers-not-array/upserting.test.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers[0]'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('Expected \'identifiers\' to be of type Array.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.1.0/identifiers_index/errors/out-of-range-index-1/upserting.test.js b/tests/upserting/1.1.0/identifiers_index/errors/out-of-range-index-1/upserting.test.js deleted file mode 100644 index d0e5de61..00000000 --- a/tests/upserting/1.1.0/identifiers_index/errors/out-of-range-index-1/upserting.test.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers[1]'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('Invalid upsert location index.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.1.0/identifiers_index/errors/out-of-range-index-99/upserting.test.js b/tests/upserting/1.1.0/identifiers_index/errors/out-of-range-index-99/upserting.test.js deleted file mode 100644 index 60d4e5ee..00000000 --- a/tests/upserting/1.1.0/identifiers_index/errors/out-of-range-index-99/upserting.test.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers[99]'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('Invalid upsert location index.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.1.0/identifiers_index/overwrite/upserting.test.js b/tests/upserting/1.1.0/identifiers_index/overwrite/upserting.test.js deleted file mode 100644 index 0d9fc1ef..00000000 --- a/tests/upserting/1.1.0/identifiers_index/overwrite/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers[0]'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.2.0/doi/append/upserting.test.js b/tests/upserting/1.2.0/doi/append/upserting.test.js deleted file mode 100644 index 987e1883..00000000 --- a/tests/upserting/1.2.0/doi/append/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'doi'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.2.0/doi/overwrite/upserting.test.js b/tests/upserting/1.2.0/doi/overwrite/upserting.test.js deleted file mode 100644 index 987e1883..00000000 --- a/tests/upserting/1.2.0/doi/overwrite/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'doi'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.2.0/identifiers_0/append/upserting.test.js b/tests/upserting/1.2.0/identifiers_0/append/upserting.test.js deleted file mode 100644 index 6d94fa1c..00000000 --- a/tests/upserting/1.2.0/identifiers_0/append/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.2.0/identifiers_0/overwrite/upserting.test.js b/tests/upserting/1.2.0/identifiers_0/overwrite/upserting.test.js deleted file mode 100644 index 6d94fa1c..00000000 --- a/tests/upserting/1.2.0/identifiers_0/overwrite/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.2.0/identifiers_index/append/upserting.test.js b/tests/upserting/1.2.0/identifiers_index/append/upserting.test.js deleted file mode 100644 index 0d9fc1ef..00000000 --- a/tests/upserting/1.2.0/identifiers_index/append/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers[0]'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.2.0/identifiers_index/errors/identifiers-not-array/upserting.test.js b/tests/upserting/1.2.0/identifiers_index/errors/identifiers-not-array/upserting.test.js deleted file mode 100644 index 52fea4d0..00000000 --- a/tests/upserting/1.2.0/identifiers_index/errors/identifiers-not-array/upserting.test.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers[0]'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('Expected \'identifiers\' to be of type Array.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.2.0/identifiers_index/errors/out-of-range-index-1/upserting.test.js b/tests/upserting/1.2.0/identifiers_index/errors/out-of-range-index-1/upserting.test.js deleted file mode 100644 index d0e5de61..00000000 --- a/tests/upserting/1.2.0/identifiers_index/errors/out-of-range-index-1/upserting.test.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers[1]'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('Invalid upsert location index.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.2.0/identifiers_index/errors/out-of-range-index-99/upserting.test.js b/tests/upserting/1.2.0/identifiers_index/errors/out-of-range-index-99/upserting.test.js deleted file mode 100644 index 60d4e5ee..00000000 --- a/tests/upserting/1.2.0/identifiers_index/errors/out-of-range-index-99/upserting.test.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers[99]'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('Invalid upsert location index.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/1.2.0/identifiers_index/overwrite/upserting.test.js b/tests/upserting/1.2.0/identifiers_index/overwrite/upserting.test.js deleted file mode 100644 index 0d9fc1ef..00000000 --- a/tests/upserting/1.2.0/identifiers_index/overwrite/upserting.test.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - fs.copyFileSync(src('expected.yml'), dest('expected.yml')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers[0]'; - const prereserved_doi = '10.5281/upserted.1234567'; - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - const actual = fs.readFileSync('CITATION.cff', 'utf8'); - const expected = fs.readFileSync('expected.yml', 'utf8'); - expect(actual).toEqual(expected); -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/errors/cff-no-object/upserting.test.js b/tests/upserting/errors/cff-no-object/upserting.test.js deleted file mode 100644 index f8acdd63..00000000 --- a/tests/upserting/errors/cff-no-object/upserting.test.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'doi'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('Could not parse the contents of CITATION.cff into an object.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/errors/cff-not-yaml/upserting.test.js b/tests/upserting/errors/cff-not-yaml/upserting.test.js deleted file mode 100644 index 83bfde96..00000000 --- a/tests/upserting/errors/cff-not-yaml/upserting.test.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.bin'), dest('CITATION.cff')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'doi'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('Could not parse the contents of CITATION.cff as YAML. Try https://yamllint.com to fix the problem.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/errors/invalid-upsert-location/upserting.test.js b/tests/upserting/errors/invalid-upsert-location/upserting.test.js deleted file mode 100644 index d587e104..00000000 --- a/tests/upserting/errors/invalid-upsert-location/upserting.test.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'identifiers(0)'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('Invalid value for variable \'upsert-location\'.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/errors/no-cff-file/upserting.test.js b/tests/upserting/errors/no-cff-file/upserting.test.js deleted file mode 100644 index 41b0ee6e..00000000 --- a/tests/upserting/errors/no-cff-file/upserting.test.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'doi'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('File CITATION.cff doesn\'t exist.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); diff --git a/tests/upserting/errors/no-cff-version/upserting.test.js b/tests/upserting/errors/no-cff-version/upserting.test.js deleted file mode 100644 index 1c9cfc07..00000000 --- a/tests/upserting/errors/no-cff-version/upserting.test.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const upserting_1 = require("../../../../src/upserting"); -const fs = __importStar(require("fs")); -const path = __importStar(require("path")); -const os = __importStar(require("os")); -const assert_1 = require("assert"); -let temporary_directory; -beforeEach(() => { - const src = (f) => { - return path.join(__dirname, f); - }; - const dest = (f) => { - return path.join(temporary_directory, f); - }; - temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`); - fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')); - process.chdir(temporary_directory); -}); -test('upserting a doi', () => { - const upsert_location = 'doi'; - const prereserved_doi = '10.5281/upserted.1234567'; - const throwfun = () => { - upserting_1.upsert_prereserved_doi(upsert_location, prereserved_doi); - }; - expect(throwfun).toThrow(assert_1.AssertionError); - try { - throwfun(); - } - catch (err) { - expect(err.message).toBe('CITATION.cff is missing required key \'cff-version\'.'); - } -}); -afterEach(() => { - fs.rmdirSync(temporary_directory, { recursive: true }); -}); From 61367630edd9b33c1a08d648e7fba595501067ed Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Wed, 30 Jun 2021 19:42:19 +0200 Subject: [PATCH 2/5] changed the way dates are written back to the CFF when upserting; added tests for date handling in 1.1.0 --- src/upserting.ts | 14 ++++++- tests/upserting/1.1.0/dates/CITATION.cff | 21 ++++++++++ tests/upserting/1.1.0/dates/expected.yml | 21 ++++++++++ tests/upserting/1.1.0/dates/upserting.test.ts | 41 +++++++++++++++++++ 4 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 tests/upserting/1.1.0/dates/CITATION.cff create mode 100644 tests/upserting/1.1.0/dates/expected.yml create mode 100644 tests/upserting/1.1.0/dates/upserting.test.ts diff --git a/src/upserting.ts b/src/upserting.ts index aa84b510..bdac2d2f 100644 --- a/src/upserting.ts +++ b/src/upserting.ts @@ -144,7 +144,19 @@ export const upsert_prereserved_doi = (upsert_location: string, prereserved_doi: const write_cff_file = (cff: CffObject): void => { - const cffstr = yaml.dump(cff, { sortKeys: false }) + let cffstr = yaml.dump(cff, { sortKeys: false }) + // replace full precision dates with just YYYY-MM-DD before writing to file + const regexes = [ + new RegExp('(?date-accessed): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'), + new RegExp('(?date-downloaded): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'), + new RegExp('(?date-published): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'), + new RegExp('(?date-released): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'), + new RegExp('(?date-end): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'), + new RegExp('(?date-start): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g') + ] + for (const regex of regexes) { + cffstr = cffstr.replace(regex, '$: $') + } fs.writeFileSync('CITATION.cff', cffstr, 'utf8') return } diff --git a/tests/upserting/1.1.0/dates/CITATION.cff b/tests/upserting/1.1.0/dates/CITATION.cff new file mode 100644 index 00000000..395ccc80 --- /dev/null +++ b/tests/upserting/1.1.0/dates/CITATION.cff @@ -0,0 +1,21 @@ +authors: + - name: anonymous +cff-version: 1.1.0 +date-released: 2020-12-31 +doi: 10.0000/FIXME +message: testing dates +references: + - authors: + - name: anonymous + date-accessed: 2020-11-30 + date-downloaded: 2020-10-30 + date-published: 2020-09-30 + date-released: 2020-08-30 + type: conference + title: reference title + conference: + name: some conference + date-end: 2020-02-02 + date-start: 2020-01-30 +title: testing dates +version: 0.0.0 diff --git a/tests/upserting/1.1.0/dates/expected.yml b/tests/upserting/1.1.0/dates/expected.yml new file mode 100644 index 00000000..334b7af6 --- /dev/null +++ b/tests/upserting/1.1.0/dates/expected.yml @@ -0,0 +1,21 @@ +authors: + - name: anonymous +cff-version: 1.1.0 +date-released: 2020-12-31 +doi: 10.5281/upserted.1234567 +message: testing dates +references: + - authors: + - name: anonymous + date-accessed: 2020-11-30 + date-downloaded: 2020-10-30 + date-published: 2020-09-30 + date-released: 2020-08-30 + type: conference + title: reference title + conference: + name: some conference + date-end: 2020-02-02 + date-start: 2020-01-30 +title: testing dates +version: 0.0.0 diff --git a/tests/upserting/1.1.0/dates/upserting.test.ts b/tests/upserting/1.1.0/dates/upserting.test.ts new file mode 100644 index 00000000..2fa05fc2 --- /dev/null +++ b/tests/upserting/1.1.0/dates/upserting.test.ts @@ -0,0 +1,41 @@ +import { upsert_prereserved_doi } from '../../../../src/upserting' +import * as fs from 'fs' +import * as path from 'path' +import * as os from 'os' + + +let temporary_directory: string; + +beforeEach(() => { + + const src = (f: string): string => { + return path.join(__dirname, f) + } + + const dest = (f: string): string => { + return path.join(temporary_directory, f) + } + + temporary_directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zenodraft-action-testing.`) + fs.copyFileSync(src('CITATION.cff'), dest('CITATION.cff')) + fs.copyFileSync(src('expected.yml'), dest('expected.yml')) + process.chdir(temporary_directory) +}) + + +test('upserting a doi',() => { + + const upsert_location = 'doi' + const prereserved_doi = '10.5281/upserted.1234567' + + upsert_prereserved_doi(upsert_location, prereserved_doi) + + const actual = fs.readFileSync('CITATION.cff', 'utf8') + const expected = fs.readFileSync('expected.yml', 'utf8') + expect(actual).toEqual(expected); +}); + + +afterEach(() => { + fs.rmdirSync(temporary_directory, { recursive: true }); +}) From 654b2400c504fd61a177c3dd2f8f69b23a619c23 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Wed, 30 Jun 2021 19:48:50 +0200 Subject: [PATCH 3/5] now using zenodraft 0.9.1 from npmjs.com --- node_modules/zenodraft/README.md | 11 ++++-- node_modules/zenodraft/assets/autocomplete.sh | 2 +- node_modules/zenodraft/dist/cli.js | 2 +- node_modules/zenodraft/dist/cli.mjs | 2 +- node_modules/zenodraft/package.json | 35 +++++++++---------- package-lock.json | 7 ++-- package.json | 4 +-- 7 files changed, 35 insertions(+), 28 deletions(-) diff --git a/node_modules/zenodraft/README.md b/node_modules/zenodraft/README.md index 7a6458be..6ba444f3 100644 --- a/node_modules/zenodraft/README.md +++ b/node_modules/zenodraft/README.md @@ -8,9 +8,16 @@ Note: This project is a work in progress.

You are welcome to try it out and leave feedback at https://github.com/zenodraft/zenodraft/issues though.

+

+ github repo badge + github license badge + npm version + DOI + fair-software badge +



- + ## CLI to manage depositions on Zenodo or Zenodo Sandbox @@ -190,7 +197,7 @@ node_modules/.bin/zenodraft --help Building the docker container: ```shell -docker build -t zenodraft https://raw.githubusercontent.com/zenodraft/zenodraft/0.9.0/Dockerfile +docker build -t zenodraft https://raw.githubusercontent.com/zenodraft/zenodraft/0.9.1/Dockerfile ``` Running the docker container: diff --git a/node_modules/zenodraft/assets/autocomplete.sh b/node_modules/zenodraft/assets/autocomplete.sh index 7eadb7f6..13195e24 100644 --- a/node_modules/zenodraft/assets/autocomplete.sh +++ b/node_modules/zenodraft/assets/autocomplete.sh @@ -51,7 +51,7 @@ _zenodraft_completions() COMPREPLY=($(compgen -W "" -- ${cur})) ;; ${COMP_WORDS[0]}/file/add/${draft_id}/) - COMPREPLY=($(compgen -W "")) + COMPREPLY=($(compgen -o filenames -A file -- ${cur})) ;; ${COMP_WORDS[0]}/file/delete/) COMPREPLY=($(compgen -W "" -- ${cur})) diff --git a/node_modules/zenodraft/dist/cli.js b/node_modules/zenodraft/dist/cli.js index 2c1ce777..06b3737b 100644 --- a/node_modules/zenodraft/dist/cli.js +++ b/node_modules/zenodraft/dist/cli.js @@ -160,7 +160,7 @@ const cli = () => { return metadata; })(); const zenodraft = new commander.Command('zenodraft') - .version('0.9.0') + .version('0.9.1') .description('CLI to manage depositions on Zenodo or Zenodo Sandbox.') .option('-s, --sandbox', 'run on zenodo sandbox instead of regular zenodo', false) .option('-v, --verbose', 'verbose mode', false); diff --git a/node_modules/zenodraft/dist/cli.mjs b/node_modules/zenodraft/dist/cli.mjs index 5dd20de4..d4d30a9d 100644 --- a/node_modules/zenodraft/dist/cli.mjs +++ b/node_modules/zenodraft/dist/cli.mjs @@ -157,7 +157,7 @@ export const cli = () => { return metadata; })(); const zenodraft = new commander.Command('zenodraft') - .version('0.9.0') + .version('0.9.1') .description('CLI to manage depositions on Zenodo or Zenodo Sandbox.') .option('-s, --sandbox', 'run on zenodo sandbox instead of regular zenodo', false) .option('-v, --verbose', 'verbose mode', false); diff --git a/node_modules/zenodraft/package.json b/node_modules/zenodraft/package.json index e545775e..9b47477e 100644 --- a/node_modules/zenodraft/package.json +++ b/node_modules/zenodraft/package.json @@ -1,29 +1,26 @@ { - "_args": [ - [ - "git+https://github.com/zenodraft/zenodraft.git#0.9.0", - "/home/daisycutter/github/zenodraft/action" - ] - ], - "_from": "git+https://github.com/zenodraft/zenodraft.git#0.9.0", - "_id": "zenodraft@git+https://github.com/zenodraft/zenodraft.git#b28ccd3a366196e52927bb3a199463cc52475ec2", + "_from": "zenodraft@0.9.1", + "_id": "zenodraft@0.9.1", "_inBundle": false, - "_integrity": "", + "_integrity": "sha512-jzpY7aLgp8kvAFEgTQHrsarvmJrpzjz2/IFKvytAAKlkZCpVFl6kbK42L26OyoU2YjC4qU+hHTvtS9CEQTXKlQ==", "_location": "/zenodraft", "_phantomChildren": {}, "_requested": { - "type": "git", - "raw": "git+https://github.com/zenodraft/zenodraft.git#0.9.0", - "rawSpec": "git+https://github.com/zenodraft/zenodraft.git#0.9.0", - "saveSpec": "git+https://github.com/zenodraft/zenodraft.git#0.9.0", - "fetchSpec": "https://github.com/zenodraft/zenodraft.git", - "gitCommittish": "0.9.0" + "type": "version", + "registry": true, + "raw": "zenodraft@0.9.1", + "name": "zenodraft", + "escapedName": "zenodraft", + "rawSpec": "0.9.1", + "saveSpec": null, + "fetchSpec": "0.9.1" }, "_requiredBy": [ "/" ], - "_resolved": "git+https://github.com/zenodraft/zenodraft.git#b28ccd3a366196e52927bb3a199463cc52475ec2", - "_spec": "git+https://github.com/zenodraft/zenodraft.git#0.9.0", + "_resolved": "https://registry.npmjs.org/zenodraft/-/zenodraft-0.9.1.tgz", + "_shasum": "3c595ebd133b035a71a6ecd1610200169e624ab6", + "_spec": "zenodraft@0.9.1", "_where": "/home/daisycutter/github/zenodraft/action", "author": { "name": "Jurriaan H. Spaaks" @@ -35,12 +32,14 @@ "bugs": { "url": "https://github.com/zenodraft/zenodraft/issues" }, + "bundleDependencies": false, "dependencies": { "commander": "^7.2.0", "dotenv": "^10.0.0", "mime-types": "^2.1.31", "node-fetch": "^2.6.1" }, + "deprecated": false, "description": "CLI to manage depositions on Zenodo and Zenodo Sandbox", "devDependencies": { "@types/mime-types": "^2.1.0", @@ -79,5 +78,5 @@ "test": "jest tests" }, "types": "dist/zenodraft.d.ts", - "version": "0.9.0" + "version": "0.9.1" } diff --git a/package-lock.json b/package-lock.json index 75e28a97..7d62ea30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "action", - "version": "0.9.0", + "version": "0.9.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3364,8 +3364,9 @@ "dev": true }, "zenodraft": { - "version": "git+https://github.com/zenodraft/zenodraft.git#b28ccd3a366196e52927bb3a199463cc52475ec2", - "from": "git+https://github.com/zenodraft/zenodraft.git#0.9.0", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/zenodraft/-/zenodraft-0.9.1.tgz", + "integrity": "sha512-jzpY7aLgp8kvAFEgTQHrsarvmJrpzjz2/IFKvytAAKlkZCpVFl6kbK42L26OyoU2YjC4qU+hHTvtS9CEQTXKlQ==", "requires": { "commander": "^7.2.0", "dotenv": "^10.0.0", diff --git a/package.json b/package.json index 15992306..95fcb3b8 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "@actions/github": "^5.0.0", "js-yaml": "^4.1.0", "typescript": "^4.3.2", - "zenodraft": "git+https://github.com/zenodraft/zenodraft.git#0.9.0" + "zenodraft": "0.9.1" }, "description": "GitHub action to automate making draft depositions on Zenodo or Zenodo Sandbox", "homepage": "https://github.com/zenodraft/action#readme", @@ -33,7 +33,7 @@ "test": "jest --config jest.config.js", "transpile": "tsc -p tsconfig.json" }, - "version": "0.9.0", + "version": "0.9.1", "devDependencies": { "@types/jest": "^26.0.23", "@types/js-yaml": "^4.0.1", From 9f8ee2f0a3607763a84b8d52c79339f78523a7b8 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Wed, 30 Jun 2021 19:49:13 +0200 Subject: [PATCH 4/5] updated text to point to action v0.9.1 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 80a02c40..6856c438 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# `zenodraft/action@0.9.0` PRERELEASE +# `zenodraft/action@0.9.1` PRERELEASE Automates drafting depositions on Zenodo or Zenodo Sandbox. @@ -34,7 +34,7 @@ jobs: from repository file .zenodo.json env: ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }} - uses: zenodraft/action@0.9.0 + uses: zenodraft/action@0.9.1 with: collection: 1234567 metadata: .zenodo.json From 5dba83cb9123c2b0491b71fe1fc0a1c0444265d6 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Wed, 30 Jun 2021 19:49:49 +0200 Subject: [PATCH 5/5] updated lib with the new date fix (#9) --- lib/upserting.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/upserting.js b/lib/upserting.js index de21973a..ab7aa2ab 100644 --- a/lib/upserting.js +++ b/lib/upserting.js @@ -125,7 +125,19 @@ const upsert_prereserved_doi = (upsert_location, prereserved_doi) => { }; exports.upsert_prereserved_doi = upsert_prereserved_doi; const write_cff_file = (cff) => { - const cffstr = yaml.dump(cff, { sortKeys: false }); + let cffstr = yaml.dump(cff, { sortKeys: false }); + // replace full precision dates with just YYYY-MM-DD before writing to file + const regexes = [ + new RegExp('(?date-accessed): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'), + new RegExp('(?date-downloaded): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'), + new RegExp('(?date-published): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'), + new RegExp('(?date-released): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'), + new RegExp('(?date-end): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'), + new RegExp('(?date-start): (?[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g') + ]; + for (const regex of regexes) { + cffstr = cffstr.replace(regex, '$: $'); + } fs.writeFileSync('CITATION.cff', cffstr, 'utf8'); return; };