feat(log): Do not delete an empty list of records
This commit is contained in:
parent
3aacc6e2a5
commit
1f8ee17433
@ -75,6 +75,7 @@ module Jekyll
|
|||||||
#
|
#
|
||||||
# Does nothing in dry run mode
|
# Does nothing in dry run mode
|
||||||
def self.delete_records_by_id(index, ids)
|
def self.delete_records_by_id(index, ids)
|
||||||
|
return if ids.empty?
|
||||||
Logger.log("I:Deleting #{ids.length} records")
|
Logger.log("I:Deleting #{ids.length} records")
|
||||||
return if Configurator.dry_run?
|
return if Configurator.dry_run?
|
||||||
|
|
||||||
|
|||||||
@ -145,6 +145,17 @@ describe(Jekyll::Algolia::Indexer) do
|
|||||||
.with(ids)
|
.with(ids)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when deleting zero records' do
|
||||||
|
let(:ids) { [] }
|
||||||
|
before do
|
||||||
|
allow(logger).to receive(:log)
|
||||||
|
end
|
||||||
|
it do
|
||||||
|
expect(logger).to_not have_received(:log)
|
||||||
|
expect(index).to_not have_received(:delete_objects!)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.remote_object_ids' do
|
describe '.remote_object_ids' do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user