Skip to content

Commit

Permalink
git, do not modify test data files on checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
scholarsmate committed Mar 27, 2024
1 parent c2735f6 commit 7b09061
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# to native line endings on checkout.
*.bat text
*.c text
*.cmake text
*.cpp text
*.gyp text
*.h text
Expand All @@ -24,6 +25,8 @@
*.js text
*.json text
*.md text
*.proto text
*.scala text
*.sh text
*.ts text
*.yml text
Expand All @@ -32,3 +35,7 @@
# Denote all files that are truly binary and should not be modified.
*.dat binary
*.png binary

# Test data files should not be modified.
core/src/tests/data/* binary
packages/client/tests/specs/data/* binary
8 changes: 5 additions & 3 deletions packages/client/tests/specs/editing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ describe('Editing', () => {
it('Should overwrite some data', async () => {
expect(await getComputedFileSize(session_id)).to.equal(0)
const data: Uint8Array = Buffer.from('abcdefghijklmnopqrstuvwxyΩ') // Note: Ω is a 2-byte character
expect(data.length).equals(27)
const stats = new EditStats()
let change_id = await overwrite(session_id, 0, data, stats)
expect(stats.overwrite_count).to.equal(1)
Expand All @@ -141,12 +142,13 @@ describe('Editing', () => {
let file_size = await getComputedFileSize(session_id)
expect(file_size).equals(data.length)
let last_change = await getLastChange(session_id)
expect(last_change.getData_asU8()).deep.equals(data)
expect(last_change.getSessionId()).to.equal(session_id)
expect(last_change.getOffset()).to.equal(0)
expect(last_change.getKind()).to.equal(ChangeKind.CHANGE_OVERWRITE)
expect(last_change.getSerial()).to.equal(1)
expect(last_change.getLength()).to.equal(27)
expect(last_change.getSessionId()).to.equal(session_id)
expect(last_change.getLength()).to.equal(data.length)
expect(last_change.getData_asU8().length).equals(data.length)
expect(last_change.getData_asU8()).deep.equals(data)
let overwrite_change_id = await overwrite(
session_id,
13,
Expand Down

0 comments on commit 7b09061

Please sign in to comment.