summaryrefslogtreecommitdiff
path: root/packages/astro/test/experimental-content-collections-cache-invalidation.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro/test/experimental-content-collections-cache-invalidation.test.js')
-rw-r--r--packages/astro/test/experimental-content-collections-cache-invalidation.test.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/packages/astro/test/experimental-content-collections-cache-invalidation.test.js b/packages/astro/test/experimental-content-collections-cache-invalidation.test.js
index abc8ea839..0f4534e51 100644
--- a/packages/astro/test/experimental-content-collections-cache-invalidation.test.js
+++ b/packages/astro/test/experimental-content-collections-cache-invalidation.test.js
@@ -11,14 +11,17 @@ describe('Experimental Content Collections cache - invalidation', () => {
this.cacheDir = new URL(relCacheDir, this.root);
this.tmpDir = new URL(`./tmp` + relCacheDir.slice(1), this.root);
}
+
backup() {
this.rmTmp();
copyFiles(this.cacheDir, this.tmpDir);
}
+
restore() {
fs.rmSync(this.cacheDir, { recursive: true });
copyFiles(this.tmpDir, this.cacheDir);
}
+
rmTmp() {
fs.rmSync(this.tmpDir, { force: true, recursive: true });
}
@@ -26,6 +29,7 @@ describe('Experimental Content Collections cache - invalidation', () => {
class ManifestTestPlugin {
used = false;
+
plugin() {
return {
name: '@test/manifest-used',
@@ -99,4 +103,35 @@ describe('Experimental Content Collections cache - invalidation', () => {
assert.equal(testPlugin.used, false, 'manifest not used because of lockfile mismatch');
});
});
+
+ describe('duplicate content', () => {
+ let fixture,
+ backup,
+ /** @type {ManifestTestPlugin} */
+ testPlugin;
+ before(async () => {
+ testPlugin = new ManifestTestPlugin();
+ fixture = await loadFixture({
+ root: './fixtures/content-collections-same-contents/',
+ cacheDir: './cache/same-contents/',
+ experimental: { contentCollectionCache: true },
+ integrations: [testPlugin.plugin()],
+ });
+ backup = new CacheBackup(
+ './fixtures/content-collections-same-contents/',
+ './cache/same-contents/'
+ );
+ backup.backup();
+ await fixture.build();
+ });
+
+ after(async () => {
+ backup.restore();
+ //await fixture.clean();
+ });
+
+ it('Manifest was not used', () => {
+ assert.equal(testPlugin.used, false, 'manifest not used because of lockfile mismatch');
+ });
+ });
});